Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
build updates
Dane Schneiderdc516e77e689
diff --git a/app/server/syntax/structural_edits.go b/app/server/syntax/structural_edits.goindex f50912b7..ea77ece0 100644--- a/app/server/syntax/structural_edits.go+++ b/app/server/syntax/structural_edits.go@@ -65,17 +65,17 @@ func ApplyChanges(originalLines := strings.Split(original, "\n")proposedLines := strings.Split(proposed, "\n")- if language == "json" {- for i, line := range proposedLines {- // keep indentation for syntax parsing- content := strings.TrimSpace(line)- if removalsByLine[Removal(i+1)] {- proposedLines[i] = strings.Replace(line, content, "", 1)- } else if refsByLine[Reference(i+1)] {- proposedLines[i] = strings.Replace(line, content, "", 1)- }- }- }+ // if language == "json" {+ // for i, line := range proposedLines {+ // // keep indentation for syntax parsing+ // content := strings.TrimSpace(line)+ // if removalsByLine[Removal(i+1)] {+ // proposedLines[i] = strings.Replace(line, content, "", 1)+ // } else if refsByLine[Reference(i+1)] {+ // proposedLines[i] = strings.Replace(line, content, "", 1)+ // }+ // }+ // }proposedWithoutRemovals := strings.Join(proposedLines, "\n")@@ -362,8 +362,8 @@ func ApplyChanges(}refOpen = true- setOLineNum(oLineNum + 1)refStart = oLineNum+ setOLineNum(oLineNum + 1)if verboseLogging {fmt.Printf("setting refStart: %d\n", refStart)@@ -863,12 +863,12 @@ func (s TreeSitterSection) String(sourceLines []string, bytes []byte) string {fmt.Printf("section.String startIdx: %d, endIdx: %d\n", startIdx, endIdx)}- parent := lastNode.Parent()- parentEndNode := parent.Child(int(parent.ChildCount()) - 1)- lastLine := sourceLines[endIdx]- if lastLine == parentEndNode.Content(bytes) {- endIdx--- }+ // parent := lastNode.Parent()+ // parentEndNode := parent.Child(int(parent.ChildCount()) - 1)+ // lastLine := sourceLines[endIdx]+ // if lastLine == parentEndNode.Content(bytes) {+ // endIdx--+ // }result := strings.Join(sourceLines[startIdx:endIdx+1], "\n") + "\n"diff --git a/app/server/syntax/structural_edits_test.go b/app/server/syntax/structural_edits_test.goindex 67ef7b88..972898e4 100644--- a/app/server/syntax/structural_edits_test.go+++ b/app/server/syntax/structural_edits_test.go@@ -753,6 +753,229 @@ func TestStructuralReplacements(t *testing.T) {3, 24, 26,},},++ {+ name: "json multi-level update 2",+ original: `+{+ "name": "vscode-plandex",+ "displayName": "Plandex",+ "description": "VSCode extension for Plandex integration",+ "version": "0.1.0",+ "publisher": "plandex",+ "engines": {+ "vscode": "^1.80.0"+ },+ "categories": [+ "Other"+ ],+ "activationEvents": [+ "onLanguage:pdx"+ ],+ "main": "./dist/extension.js",+ "contributes": {+ "languages": [+ {+ "id": "pdx",+ "aliases": ["Plandex", "pdx"],+ "extensions": [".pdx"],+ "configuration": "./language-configuration.json"+ }+ ],+ "grammars": [+ {+ "language": "pdx",+ "scopeName": "source.mdx",+ "path": "./syntaxes/mdx.tmLanguage.json",+ "embeddedLanguages": {+ "meta.embedded.block.yaml": "yaml",+ "meta.embedded.block.markdown": "markdown"+ }+ }+ ],+ "commands": [+ {+ "command": "plandex.tellPlandex",+ "title": "Tell Plandex",+ "icon": "$(play)"+ }+ ],+ "keybindings": [+ {+ "command": "plandex.showFilePicker",+ "key": "@",+ "when": "editorTextFocus && editorLangId == pdx"+ }+ ],+ "menus": {+ "editor/title": [+ {+ "command": "plandex.tellPlandex",+ "group": "navigation",+ "when": "editorLangId == pdx"+ }+ ]+ }+ },+ "scripts": {+ "vscode:prepublish": "npm run package",+ "compile": "webpack",+ "watch": "webpack --watch",+ "package": "webpack --mode production --devtool hidden-source-map",+ "compile-tests": "tsc -p . --outDir out",+ "watch-tests": "tsc -p . -w --outDir out",+ "pretest": "npm run compile-tests && npm run compile && npm run lint",+ "lint": "eslint src --ext ts",+ "test": "node ./out/test/runTest.js"+ },+ "devDependencies": {+ "@types/glob": "^8.1.0",+ "@types/mocha": "^10.0.1",+ "@types/node": "^20.2.5",+ "@types/vscode": "^1.80.0",+ "@typescript-eslint/eslint-plugin": "^5.59.8",+ "@typescript-eslint/parser": "^5.59.8",+ "eslint": "^8.41.0",+ "glob": "^8.1.0",+ "mocha": "^10.2.0",+ "ts-loader": "^9.4.3",+ "typescript": "^5.1.3",+ "webpack": "^5.85.0",+ "webpack-cli": "^5.1.1"+ },+ "dependencies": {+ "yaml": "^2.3.1"+ }+}+`,+ proposed: `+{+ // ... existing code ...++ "contributes": {+ // ... existing code ...++ "commands": [+ {+ "command": "plandex.tellPlandex",+ "title": "Tell Plandex",+ "icon": {+ "light": "resources/light/play.svg",+ "dark": "resources/dark/play.svg"+ }+ }+ ],++ // ... existing code ...+ },++ // ... existing code ...+}+`,+ want: `+{+ "name": "vscode-plandex",+ "displayName": "Plandex",+ "description": "VSCode extension for Plandex integration",+ "version": "0.1.0",+ "publisher": "plandex",+ "engines": {+ "vscode": "^1.80.0"+ },+ "categories": [+ "Other"+ ],+ "activationEvents": [+ "onLanguage:pdx"+ ],+ "main": "./dist/extension.js",+ "contributes": {+ "languages": [+ {+ "id": "pdx",+ "aliases": ["Plandex", "pdx"],+ "extensions": [".pdx"],+ "configuration": "./language-configuration.json"+ }+ ],+ "grammars": [+ {+ "language": "pdx",+ "scopeName": "source.mdx",+ "path": "./syntaxes/mdx.tmLanguage.json",+ "embeddedLanguages": {+ "meta.embedded.block.yaml": "yaml",+ "meta.embedded.block.markdown": "markdown"+ }+ }+ ],+ "commands": [+ {+ "command": "plandex.tellPlandex",+ "title": "Tell Plandex",+ "icon": {+ "light": "resources/light/play.svg",+ "dark": "resources/dark/play.svg"+ }+ }+ ],++ "keybindings": [+ {+ "command": "plandex.showFilePicker",+ "key": "@",+ "when": "editorTextFocus && editorLangId == pdx"+ }+ ],+ "menus": {+ "editor/title": [+ {+ "command": "plandex.tellPlandex",+ "group": "navigation",+ "when": "editorLangId == pdx"+ }+ ]+ }+ },++ "scripts": {+ "vscode:prepublish": "npm run package",+ "compile": "webpack",+ "watch": "webpack --watch",+ "package": "webpack --mode production --devtool hidden-source-map",+ "compile-tests": "tsc -p . --outDir out",+ "watch-tests": "tsc -p . -w --outDir out",+ "pretest": "npm run compile-tests && npm run compile && npm run lint",+ "lint": "eslint src --ext ts",+ "test": "node ./out/test/runTest.js"+ },+ "devDependencies": {+ "@types/glob": "^8.1.0",+ "@types/mocha": "^10.0.1",+ "@types/node": "^20.2.5",+ "@types/vscode": "^1.80.0",+ "@typescript-eslint/eslint-plugin": "^5.59.8",+ "@typescript-eslint/parser": "^5.59.8",+ "eslint": "^8.41.0",+ "glob": "^8.1.0",+ "mocha": "^10.2.0",+ "ts-loader": "^9.4.3",+ "typescript": "^5.1.3",+ "webpack": "^5.85.0",+ "webpack-cli": "^5.1.1"+ },+ "dependencies": {+ "yaml": "^2.3.1"+ }+}+`,+ language: "json",+ parser: getParserForLanguage("json"),+ references: []Reference{+ 3, 6, 19, 22,+ },+ },+{name: "scala complex structures",original: `@@ -882,7 +1105,7 @@ class MetricsService(}for _, tt := range tests {- // if tt.name == "scala complex structures" {+ // if tt.name == "json multi-level update 2" {t.Run(tt.name, func(t *testing.T) {anchorLines := map[int]int{}if tt.anchorLines != nil {diff --git a/plans/vscode.md b/plans/vscode.mdnew file mode 100644index 00000000..70511738--- /dev/null+++ b/plans/vscode.md@@ -0,0 +1,50 @@+I want to build a VSCode extension that can do the following:++It should be active when editing any file with a `.pdx` extension.++`.pdx` file should have `.mdx` syntax highlighting and be treated the same as an `.mdx` file by the mdx extension.++It should track some state related to the .pdx file being edited.++It should track them through frontmatter keys at the top of the file:++- the name of the plan (if it exists) and its id+- who created the plan in the format `[name]<email> | [timestamp]`+- who last updated the plan in the same format+- plan collaborators (in the same format as the creator)+- the status of the plan+- it should use YAML (and YAML frontmatter syntax/syntax highlighting) for the frontmatter keys++- it should have `<Contexts></Contexts>` tag at the top (after the frontmatter keys) that lists the plan's context.++- it should then have a `<Prompts></Prompts>` section for the user's prompt++Don't worry about getting this data from the API yet—just use placeholder text.++-++When I type the `@` key, I want to get a list of files from the workspace (relative to the location of the .pdx file) that I can fuzzy search.++When a file is selected, unless the Plandex terminal is already active/visible, it should bring up a terminal tab in the same directory as the .pdx file.++It should run the command `plandex load [path to the selected file]` in the terminal.++-++At the top of the editor, I want a footer action bar with a `Tell Plandex` button—it should have a green 'play' icon.++When the `Tell Plandex` button is clicked, it should bring up a terminal tab in the same directory as the .pdx file, unless the Plandex terminal is already active/visible.++In the terminal, it should run `plandex new` then `plandex tell -f [location of the .pdx file being edited]`++-++Create all necessary files and folders in the `vscode` folder. Create scripts for installing dependencies, running the extension, etc. Again, prefix ALL paths with `vscode/`—you must write all files into this directory.++Write tests for core functionality.++-++Use TypeScript and create the relevant types. Don't use `any` and be strict about types.++For the webpack config file, use typescript as well.