From b22ec1259c541ed3926cea8e988091f267962f96 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Wed, 13 Nov 2024 17:53:04 -0800 Subject: [PATCH 01/24] improv: capture nested return type identifiers --- .../test/testCases/typescript.ts | 10 ++++++++++ .../function_declaration/typescript.scm | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts index 6913cb8d3..3aa9050d3 100644 --- a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts +++ b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts @@ -37,6 +37,16 @@ export const TYPESCRIPT_TEST_CASES = [ { row: 18, column: 39 }, // Person ], }, + { + nodeType: "function_declaration with array params and array return type", + fileName: "functions.ts", + language: "TypeScript", + cursorPosition: { line: 23, character: 27 }, + definitionPositions: [ + { row: 22, column: 36 }, // Person + { row: 22, column: 48 }, // Person + ], + }, { nodeType: "method_declaration", fileName: "class.ts", diff --git a/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm b/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm index 24dc04e22..fac63a3d2 100644 --- a/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm +++ b/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm @@ -1,10 +1,24 @@ -; Pattern for capturing the return type +; Pattern for return type with direct type_identifier ( (function_declaration - (type_annotation) @return_type + (type_annotation + (type_identifier) @return_type + ) ) ) +; Pattern for return type with one level of nesting +( + (function_declaration + (type_annotation + (_ + (type_identifier) @param_type + ) + ) + ) +) + + ; Pattern for parameters with direct type_identifier ( (function_declaration From bfd9d8e8dd1b1aae5fcdd909e7411497153fde70 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Wed, 13 Nov 2024 17:59:27 -0800 Subject: [PATCH 02/24] improv: capture nested return types --- .../root-path-context/test/files/class.ts | 4 ++++ .../test/testCases/typescript.ts | 16 +++++++++++++++- .../method_definition/typescript.scm | 17 +++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/core/autocomplete/context/root-path-context/test/files/class.ts b/core/autocomplete/context/root-path-context/test/files/class.ts index 017b592ae..b2bd4ec78 100644 --- a/core/autocomplete/context/root-path-context/test/files/class.ts +++ b/core/autocomplete/context/root-path-context/test/files/class.ts @@ -30,4 +30,8 @@ class Group extends BaseClass implements FirstInterface, SecondInterface { addPeople(people: Person[]) { this.people = [...this.people, ...people]; } + + getAddresses(people: Person[]): Address[] { + return people.map((person) => person.address); + } } diff --git a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts index 3aa9050d3..2454af54e 100644 --- a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts +++ b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts @@ -48,7 +48,7 @@ export const TYPESCRIPT_TEST_CASES = [ ], }, { - nodeType: "method_declaration", + nodeType: "method_declaration with a param and a return type", fileName: "class.ts", language: "TypeScript", cursorPosition: { line: 18, character: 26 }, @@ -96,4 +96,18 @@ export const TYPESCRIPT_TEST_CASES = [ { row: 29, column: 26 }, // Person ], }, + { + nodeType: + "method_declaration with array type arguments and array type return", + fileName: "class.ts", + language: "TypeScript", + cursorPosition: { line: 34, character: 50 }, + definitionPositions: [ + { row: 9, column: 29 }, // BaseClass + { row: 9, column: 55 }, // FirstInterface + { row: 9, column: 72 }, // SecondInterface + { row: 33, column: 29 }, // Person + { row: 33, column: 41 }, // Address + ], + }, ]; diff --git a/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm b/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm index 9f8685385..545d11d97 100644 --- a/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm +++ b/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm @@ -1,7 +1,20 @@ -; Pattern for capturing the return type +; Pattern for return type with direct type_identifier ( (method_definition - (type_annotation) @return_type + (type_annotation + (type_identifier) @return_type + ) + ) +) + +; Pattern for return type with one level of nesting +( + (method_definition + (type_annotation + (_ + (type_identifier) @param_type + ) + ) ) ) From 079a33bba83492646eb829e81d75b14dda6a1fae Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Wed, 13 Nov 2024 18:06:54 -0800 Subject: [PATCH 03/24] improv: capture generic return types and arguments --- .../root-path-context/test/files/functions.ts | 7 +++++ .../test/testCases/typescript.ts | 15 +++++++++- .../function_declaration/typescript.scm | 29 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/core/autocomplete/context/root-path-context/test/files/functions.ts b/core/autocomplete/context/root-path-context/test/files/functions.ts index 2b6125a74..ec6e0dec1 100644 --- a/core/autocomplete/context/root-path-context/test/files/functions.ts +++ b/core/autocomplete/context/root-path-context/test/files/functions.ts @@ -23,3 +23,10 @@ function getHardcodedAddress(): Address { function getAddresses(people: Person[]): Address[] { return people[0].address; } + +function logPersonWithAddress(person: Person
): Person
{ + console.log( + `Name: ${person.name}, Age: ${person.age}, Address: ${person.address.street}`, + ); + return person; +} diff --git a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts index 2454af54e..4dbe61cf2 100644 --- a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts +++ b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts @@ -44,7 +44,20 @@ export const TYPESCRIPT_TEST_CASES = [ cursorPosition: { line: 23, character: 27 }, definitionPositions: [ { row: 22, column: 36 }, // Person - { row: 22, column: 48 }, // Person + { row: 22, column: 48 }, // Address + ], + }, + { + nodeType: + "function_declaration with generic params and generic return type", + fileName: "functions.ts", + language: "TypeScript", + cursorPosition: { line: 27, character: 14 }, + definitionPositions: [ + { row: 26, column: 44 }, // Person + { row: 26, column: 52 }, // Address + { row: 26, column: 62 }, // Person + { row: 26, column: 70 }, // Address ], }, { diff --git a/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm b/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm index fac63a3d2..52b62f9bd 100644 --- a/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm +++ b/extensions/vscode/tree-sitter/root-path-context-queries/function_declaration/typescript.scm @@ -18,6 +18,18 @@ ) ) +; Pattern for return type with two levels of nesting +( + (function_declaration + (type_annotation + (_ + (_ + (type_identifier) @return_type + ) + ) + ) + ) +) ; Pattern for parameters with direct type_identifier ( @@ -45,4 +57,21 @@ ) ) ) +) + +; Pattern for parameters with two levels of nesting +( + (function_declaration + (formal_parameters + (_ + (type_annotation + (_ + (_ + (type_identifier) @param_type + ) + ) + ) + ) + ) + ) ) \ No newline at end of file From 9ff547ec371fa9b0cf8905306a6cb657c97230cd Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 13 Nov 2024 23:37:16 -0800 Subject: [PATCH 04/24] bump okhttp version --- extensions/intellij/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 4c6aba783..afe24b719 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -25,7 +25,7 @@ repositories { mavenCentral() } // https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog dependencies { // implementation(libs.annotations) - implementation("com.squareup.okhttp3:okhttp:4.9.2") { + implementation("com.squareup.okhttp3:okhttp:4.12.0") { exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib") } implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.32") From 48c0caec7b83a222d1a214c3c1b38ff80a8280d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:46 +0000 Subject: [PATCH 05/24] build(deps): bump @75lb/deep-merge from 1.1.1 to 1.1.2 in /binary Bumps [@75lb/deep-merge](https://github.com/75lb/deep-merge) from 1.1.1 to 1.1.2. - [Commits](https://github.com/75lb/deep-merge/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: "@75lb/deep-merge" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- binary/package-lock.json | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/binary/package-lock.json b/binary/package-lock.json index 0d67a4725..056231b31 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -74,7 +74,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", - "lru-cache": "^10.2.2", + "lru-cache": "^11.0.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", @@ -99,6 +99,7 @@ "vectordb": "^0.4.20", "web-tree-sitter": "^0.21.0", "win-ca": "^3.5.1", + "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", "zod": "^3.23.8" @@ -135,12 +136,12 @@ } }, "node_modules/@75lb/deep-merge": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.1.tgz", - "integrity": "sha512-xvgv6pkMGBA6GwdyJbNAnDmfAIR/DfWhrj9jgWh3TY7gRm3KO46x/GPjRg6wJ0nOepwqrNxFfojebh0Df4h4Tw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz", + "integrity": "sha512-08K9ou5VNbheZFxM5tDWoqjA3ImC50DiuuJ2tj1yEPRfkp8lLLg6XAaJ4On+a0yAXor/8ay5gHnAIshRM44Kpw==", "peer": true, "dependencies": { - "lodash.assignwith": "^4.2.0", + "lodash": "^4.17.21", "typical": "^7.1.1" }, "engines": { @@ -5037,10 +5038,10 @@ "node": ">=8" } }, - "node_modules/lodash.assignwith": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz", - "integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g==", + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "peer": true }, "node_modules/lodash.camelcase": { From d06f5f105ebd749bb83c60627d82826cfcfcef82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:46 +0000 Subject: [PATCH 06/24] build(deps-dev): bump braces from 3.0.2 to 3.0.3 in /binary Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] --- binary/package-lock.json | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/binary/package-lock.json b/binary/package-lock.json index 0d67a4725..cf8565b95 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -74,7 +74,7 @@ "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", "llm-code-highlighter": "^0.0.14", - "lru-cache": "^10.2.2", + "lru-cache": "^11.0.2", "mac-ca": "^3.1.0", "node-fetch": "^3.3.2", "node-html-markdown": "^1.3.0", @@ -99,6 +99,7 @@ "vectordb": "^0.4.20", "web-tree-sitter": "^0.21.0", "win-ca": "^3.5.1", + "wink-nlp-utils": "^2.1.0", "workerpool": "^9.1.3", "yaml": "^2.4.2", "zod": "^3.23.8" @@ -2749,12 +2750,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -3545,9 +3546,9 @@ "optional": true }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" From 90a31ea2119d388161b7c3f9481b1b8f5a17402f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:51 +0000 Subject: [PATCH 07/24] build(deps): bump micromatch from 4.0.6 to 4.0.8 in /core Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.6 to 4.0.8. - [Release notes](https://github.com/micromatch/micromatch/releases) - [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/micromatch/compare/4.0.6...4.0.8) --- updated-dependencies: - dependency-name: micromatch dependency-type: indirect ... Signed-off-by: dependabot[bot] --- core/package-lock.json | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 633d60c99..eb634c849 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -11068,28 +11068,17 @@ } }, "node_modules/micromatch": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.6.tgz", - "integrity": "sha512-Y4Ypn3oujJYxJcMacVgcs92wofTHxp9FzfDpQON4msDefoC0lb3ETvQLOdLcbhSwU1bz8HrL/1sygfBIHudrkQ==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dependencies": { "braces": "^3.0.3", - "picomatch": "^4.0.2" + "picomatch": "^2.3.1" }, "engines": { "node": ">=8.6" } }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -12253,7 +12242,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, "engines": { "node": ">=8.6" }, From fc917238efb144ea08472bc4c2d197b5a4c1668f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:51 +0000 Subject: [PATCH 08/24] build(deps): bump ws and engine.io-client in /core Bumps [ws](https://github.com/websockets/ws) and [engine.io-client](https://github.com/socketio/socket.io). These dependencies needed to be updated together. Updates `ws` from 8.11.0 to 8.18.0 - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.11.0...8.18.0) Updates `engine.io-client` from 6.5.3 to 6.5.4 - [Release notes](https://github.com/socketio/socket.io/releases) - [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io/commits) --- updated-dependencies: - dependency-name: ws dependency-type: indirect - dependency-name: engine.io-client dependency-type: indirect ... Signed-off-by: dependabot[bot] --- core/package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 633d60c99..d81a435f6 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -7331,27 +7331,27 @@ } }, "node_modules/engine.io-client": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz", - "integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", + "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0", + "ws": "~8.17.1", "xmlhttprequest-ssl": "~2.0.0" } }, "node_modules/engine.io-client/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { From 6128a3d0ec2f277958ca926e48f64421e04624e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:52 +0000 Subject: [PATCH 09/24] build(deps): bump mysql2 from 3.9.7 to 3.11.4 in /core Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.7 to 3.11.4. - [Release notes](https://github.com/sidorares/node-mysql2/releases) - [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md) - [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.7...v3.11.4) --- updated-dependencies: - dependency-name: mysql2 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- core/package-lock.json | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 633d60c99..e7ed25ca8 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -5832,6 +5832,14 @@ "node": "*" } }, + "node_modules/aws-ssl-profiles": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz", + "integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==", + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/aws4": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.0.tgz", @@ -10910,6 +10918,20 @@ "node": "20 || >=22" } }, + "node_modules/lru.min": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.1.tgz", + "integrity": "sha512-FbAj6lXil6t8z4z3j0E5mfRlPzxkySotzUHwRXjlpRh10vc6AI6WN62ehZj82VG7M20rqogJ0GLwar2Xa05a8Q==", + "engines": { + "bun": ">=1.0.0", + "deno": ">=1.30.0", + "node": ">=8.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wellwelwel" + } + }, "node_modules/mac-ca": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mac-ca/-/mac-ca-3.1.0.tgz", @@ -11293,15 +11315,16 @@ } }, "node_modules/mysql2": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.7.tgz", - "integrity": "sha512-KnJT8vYRcNAZv73uf9zpXqNbvBG7DJrs+1nACsjZP1HMJ1TgXEy8wnNilXAn/5i57JizXKtrUtwDB7HxT9DDpw==", + "version": "3.11.4", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.4.tgz", + "integrity": "sha512-Z2o3tY4Z8EvSRDwknaC40MdZ3+m0sKbpnXrShQLdxPrAvcNli7jLrD2Zd2IzsRMw4eK9Yle500FDmlkIqp+krg==", "dependencies": { + "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", "iconv-lite": "^0.6.3", "long": "^5.2.1", - "lru-cache": "^8.0.0", + "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", "seq-queue": "^0.0.5", "sqlstring": "^2.3.2" @@ -11310,14 +11333,6 @@ "node": ">= 8.0" } }, - "node_modules/mysql2/node_modules/lru-cache": { - "version": "8.0.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-8.0.5.tgz", - "integrity": "sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA==", - "engines": { - "node": ">=16.14" - } - }, "node_modules/named-placeholders": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz", From 85e0f1c50c4272b2c7fac8620a2b1abc72bcd851 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:41:54 +0000 Subject: [PATCH 10/24] build(deps): bump @75lb/deep-merge from 1.1.1 to 1.1.2 in /core Bumps [@75lb/deep-merge](https://github.com/75lb/deep-merge) from 1.1.1 to 1.1.2. - [Commits](https://github.com/75lb/deep-merge/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: "@75lb/deep-merge" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- core/package-lock.json | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index 633d60c99..677fc002f 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -101,12 +101,12 @@ } }, "node_modules/@75lb/deep-merge": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.1.tgz", - "integrity": "sha512-xvgv6pkMGBA6GwdyJbNAnDmfAIR/DfWhrj9jgWh3TY7gRm3KO46x/GPjRg6wJ0nOepwqrNxFfojebh0Df4h4Tw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz", + "integrity": "sha512-08K9ou5VNbheZFxM5tDWoqjA3ImC50DiuuJ2tj1yEPRfkp8lLLg6XAaJ4On+a0yAXor/8ay5gHnAIshRM44Kpw==", "peer": true, "dependencies": { - "lodash.assignwith": "^4.2.0", + "lodash": "^4.17.21", "typical": "^7.1.1" }, "engines": { @@ -10868,12 +10868,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash.assignwith": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz", - "integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g==", - "peer": true - }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", From c0f03b9f70a598f58726556876020202df9d0f3b Mon Sep 17 00:00:00 2001 From: Vadim Zhamkov Date: Thu, 14 Nov 2024 17:32:50 +0100 Subject: [PATCH 11/24] Add more models to Nebius provider. Add more models to models list --- gui/src/pages/AddNewModel/configs/models.ts | 93 ++++++++++++++++++- .../pages/AddNewModel/configs/providers.ts | 17 +++- 2 files changed, 108 insertions(+), 2 deletions(-) diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 67c3547a7..01293f87a 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -169,6 +169,19 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["deepseek"], isOpenSource: false, }, + deepseekCoder2Lite: { + title: "DeepSeek Coder 2 Lite", + description: + "DeepSeek-Coder-V2-Lite-Instruct is an open-source code language model that supports 338 programming languages and offers a context length of up to 128,000 tokens.", + params: { + title: "DeepSeek-2-lite", + model: "deepseek-2-lite", + contextLength: 128_000, + }, + icon: "deepseek.png", + providerOptions: ["nebius"], + isOpenSource: true, + }, mistralOs: { title: "Mistral", description: @@ -359,6 +372,18 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["groq"], isOpenSource: false, }, + llama3170bNemotron: { + title: "Llama 3.1 Nemotron 70B", + description: + "Llama-3.1-Nemotron-70B-Instruct is a large language model customized by NVIDIA to improve the helpfulness of LLM generated responses to user queries.", + params: { + title: "Llama 3.1 Nemotron 70B", + model: "llama3.1-70b-nemotron", + contextLength: 128_000, + }, + icon: "meta.png", + isOpenSource: true, + }, llama321bChat: { title: "Llama3.2 1b Chat", description: @@ -628,6 +653,18 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["mistral", "askSage"], isOpenSource: false, }, + mistralNemo: { + title: "Mistral Nemo", + description: + "Mistral Nemo Instruct is a large language model developed by Mistral AI and NVIDIA.", + params: { + title: "Mistral Nemo", + model: "mistral-nemo", + contextLength: 128_000, + }, + icon: "mistral.png", + isOpenSource: true, + }, geminiPro: { title: "Gemini Pro", description: "A highly capable model created by Google DeepMind", @@ -979,7 +1016,6 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["vertexai"], isOpenSource: false, }, - gpt4gov: { title: "GPT-4 gov", description: @@ -1048,6 +1084,61 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["xAI"], isOpenSource: false, }, + gemma2_2b: { + title: "Gemma 2 2b IT", + description: + "Gemma 2 IT instruction-tuned language model developed by Google, designed for tasks like question answering, summarization, and reasoning.", + params: { + title: "Gemma 2 2b IT", + model: "gemma2-2b-it", + contextLength: 4000, + }, + isOpenSource: true, + }, + gemma2_9b: { + title: "Gemma 2 9b IT", + description: + "Gemma 2 IT instruction-tuned language model developed by Google, designed for tasks like question answering, summarization, and reasoning.", + params: { + title: "Gemma 2 9b IT", + model: "gemma2-9b-it", + contextLength: 8000, + }, + isOpenSource: true, + }, + phi3mini: { + title: "Microsoft Phi 3 mini", + description: + "Phi 3 Mini is a 3.8-billion-parameter language model developed by Microsoft.", + params: { + title: "Microsoft Phi 3 mini", + model: "phi-3-mini", + contextLength: 4000, + }, + isOpenSource: true, + }, + phi3medium: { + title: "Microsoft Phi 3 medium", + description: + "Phi 3 Medium is a 14-billion-parameter language model developed by Microsoft.", + params: { + title: "Microsoft Phi 3 medium", + model: "phi-3-medium", + contextLength: 128_000, + }, + isOpenSource: true, + }, + olmo7b: { + title: "OLMo 7b", + description: + "OLMo 7B Instruct HF is a 7-billion-parameter language model by the Allen Institute for AI, fine-tuned for question answering tasks.", + params: { + title: "OLMo 7b", + model: "olmo-7b", + contextLength: 2000, + }, + isOpenSource: true, + }, AUTODETECT: { title: "Autodetect", description: diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 39613731b..5047fbad0 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -744,7 +744,22 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo ], icon: "nebius.png", tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], - packages: [models.llama31Chat, models.Qwen2Coder, models.mistralOs], + packages: [ + models.llama318bChat, + models.llama3170bChat, + models.llama31405bChat, + models.llama3170bNemotron, + models.mistral8x7b, + models.mistral8x22b, + models.mistralNemo, + models.phi3mini, + models.phi3medium, + models.gemma2_2b, + models.gemma2_9b, + models.Qwen2Coder, + models.deepseekCoder2Lite, + models.olmo7b, + ], apiKeyUrl: "https://studio.nebius.ai/settings/api-keys", }, }; From 39a8e158cf737910cd4950d947bb5e439ec7de6d Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 14 Nov 2024 08:48:44 -0800 Subject: [PATCH 12/24] only override cmd+shift+enter/backspae when diff visible --- extensions/vscode/package-lock.json | 4 ++-- extensions/vscode/package.json | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 3f4123969..24930d980 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.228", + "version": "0.9.229", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.228", + "version": "0.9.229", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 2ecfb4768..1bf96e316 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -331,12 +331,14 @@ { "command": "continue.acceptDiff", "mac": "shift+cmd+enter", - "key": "shift+ctrl+enter" + "key": "shift+ctrl+enter", + "when": "continue.diffVisible" }, { "command": "continue.rejectDiff", "mac": "shift+cmd+backspace", - "key": "shift+ctrl+backspace" + "key": "shift+ctrl+backspace", + "when": "continue.diffVisible" }, { "command": "continue.rejectDiff", From 084fde1e341a3a2de9105c00f037c2975df63c55 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 14 Nov 2024 10:48:22 -0800 Subject: [PATCH 13/24] comment --- gui/src/components/mainInput/handleMetaKeyPress.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/handleMetaKeyPress.ts b/gui/src/components/mainInput/handleMetaKeyPress.ts index fd122350f..e01a48715 100644 --- a/gui/src/components/mainInput/handleMetaKeyPress.ts +++ b/gui/src/components/mainInput/handleMetaKeyPress.ts @@ -1,6 +1,6 @@ +import { Editor } from "@tiptap/react"; import { KeyboardEvent } from "react"; import { isWebEnvironment } from "../../util"; -import { Editor } from "@tiptap/react"; const isWebEnv = isWebEnvironment(); @@ -46,6 +46,10 @@ export const handleJetBrainsMetaKeyPress = ( } }; +/** + * We use this for VS Code to fix an .ipynb bug + * And we use it in JetBrains when OSR is turned on + */ export const handleMetaKeyPress = async (e: KeyboardEvent, editor: Editor) => { const text = editor.state.doc.textBetween( editor.state.selection.from, From 5de52c8c4f95832caa80cda0275099500e7a20ef Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 14 Nov 2024 10:30:49 -0800 Subject: [PATCH 14/24] test: hardcode gotoDefinition --- .../RootPathContextService.ts | 18 +++++++++--------- core/util/filesystem.ts | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/autocomplete/context/root-path-context/RootPathContextService.ts b/core/autocomplete/context/root-path-context/RootPathContextService.ts index 9c47138cd..2602b5acf 100644 --- a/core/autocomplete/context/root-path-context/RootPathContextService.ts +++ b/core/autocomplete/context/root-path-context/RootPathContextService.ts @@ -90,15 +90,15 @@ export class RootPathContextService { return snippets; } - await Promise.all( - query.matches(node).map(async (match) => { - for (const item of match.captures) { - const endPosition = item.node.endPosition; - const newSnippets = await this.getSnippets(filepath, endPosition); - snippets.push(...newSnippets); - } - }), - ); + const queries = query.matches(node).map(async (match) => { + for (const item of match.captures) { + const endPosition = item.node.endPosition; + const newSnippets = await this.getSnippets(filepath, endPosition); + snippets.push(...newSnippets); + } + }); + + await Promise.all(queries); return snippets; } diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index de71c15e2..42900edb5 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -20,7 +20,7 @@ import { GetGhTokenArgs } from "../protocol/ide.js"; import { getContinueGlobalPath } from "./paths.js"; class FileSystemIde implements IDE { - constructor(private readonly workspaceDir: string) { } + constructor(private readonly workspaceDir: string) {} showToast( type: ToastType, message: string, @@ -36,7 +36,7 @@ class FileSystemIde implements IDE { } gotoDefinition(location: Location): Promise { - throw new Error("Method not implemented."); + return Promise.resolve([]); } onDidChangeActiveTextEditor(callback: (filepath: string) => void): void { return; From 8a4684d762aa8a00c3423612a1a53dc12a208e12 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 14 Nov 2024 10:58:40 -0800 Subject: [PATCH 15/24] bugfix: OSR copy/paste bugs --- core/protocol/ideWebview.ts | 1 + .../toolWindow/ContinueBrowser.kt | 10 ++++---- gui/src/components/mainInput/TipTapEditor.tsx | 23 ++++++++++--------- ...MetaKeyPress.ts => handleMetaKeyIssues.ts} | 15 ++++++++++-- 4 files changed, 32 insertions(+), 17 deletions(-) rename gui/src/components/mainInput/{handleMetaKeyPress.ts => handleMetaKeyIssues.ts} (88%) diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 040f4445d..d34b01d12 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -37,6 +37,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { insertAtCursor: [{ text: string }, void]; copyText: [{ text: string }, void]; "jetbrains/editorInsetHeight": [{ height: number }, void]; + "jetbrains/isOSREnabled": [boolean, void]; "vscode/openMoveRightMarkdown": [undefined, void]; setGitHubAuthToken: [{ token: string }, void]; acceptDiff: [{ filepath: string }, void]; diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index 7891a02dc..bd76f910b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -18,8 +18,6 @@ import kotlinx.coroutines.* import org.cef.CefApp import org.cef.browser.CefBrowser import org.cef.handler.CefLoadHandlerAdapter -import com.intellij.openapi.application.ApplicationInfo -import com.intellij.openapi.util.SystemInfo class ContinueBrowser(val project: Project, url: String) { private val coroutineScope = CoroutineScope( @@ -79,8 +77,8 @@ class ContinueBrowser(val project: Project, url: String) { val browser: JBCefBrowser init { - val enableOSR = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR - this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(enableOSR).build() + val isOSREnabled = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR + this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(isOSREnabled).build() browser.jbCefClient.setProperty( @@ -136,6 +134,10 @@ class ContinueBrowser(val project: Project, url: String) { heightChangeListeners.forEach { it(height) } } + "jetbrains/isOSREnabled" -> { + respond(isOSREnabled) + } + "onLoad" -> { coroutineScope.launch { // Set the colors to match Intellij theme diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index c2646415e..0c5f36dd8 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -60,9 +60,9 @@ import { getSlashCommandDropdownOptions, } from "./getSuggestion"; import { - handleJetBrainsMetaKeyPress, - handleMetaKeyPress, -} from "./handleMetaKeyPress"; + handleJetBrainsOSRMetaKeyIssues, + handleVSCMetaKeyIssues, +} from "./handleMetaKeyIssues"; import { ComboBoxItem } from "./types"; const InputBoxDiv = styled.div<{ border?: string }>` @@ -551,17 +551,18 @@ function TipTapEditor(props: TipTapEditorProps) { * with those key actions. */ const handleKeyDown = async (e: KeyboardEvent) => { - if (!editorFocusedRef?.current) return; - setActiveKey(e.key); - // Handle meta key issues - if (isMetaEquivalentKeyPressed(e)) { - if (isJetBrains()) { - handleJetBrainsMetaKeyPress(e, editor); - } + if (!editorFocusedRef?.current || !isMetaEquivalentKeyPressed(e)) return; - await handleMetaKeyPress(e, editor); + const isOSREnabled = isJetBrains() + ? await ideMessenger.request("jetbrains/isOSREnabled", undefined) + : false; + + if (isOSREnabled) { + handleJetBrainsOSRMetaKeyIssues(e, editor); + } else { + await handleVSCMetaKeyIssues(e, editor); } }; diff --git a/gui/src/components/mainInput/handleMetaKeyPress.ts b/gui/src/components/mainInput/handleMetaKeyIssues.ts similarity index 88% rename from gui/src/components/mainInput/handleMetaKeyPress.ts rename to gui/src/components/mainInput/handleMetaKeyIssues.ts index fd122350f..90a994f60 100644 --- a/gui/src/components/mainInput/handleMetaKeyPress.ts +++ b/gui/src/components/mainInput/handleMetaKeyIssues.ts @@ -4,7 +4,12 @@ import { Editor } from "@tiptap/react"; const isWebEnv = isWebEnvironment(); -export const handleJetBrainsMetaKeyPress = ( +/** + * This handles various keypress issues when OSR is enabled + * @param e + * @param editor + */ +export const handleJetBrainsOSRMetaKeyIssues = ( e: KeyboardEvent, editor: Editor, ) => { @@ -46,7 +51,13 @@ export const handleJetBrainsMetaKeyPress = ( } }; -export const handleMetaKeyPress = async (e: KeyboardEvent, editor: Editor) => { +/** + * This handles reported issues with cut/copy/paste in .ipynb files in VSC + */ +export const handleVSCMetaKeyIssues = async ( + e: KeyboardEvent, + editor: Editor, +) => { const text = editor.state.doc.textBetween( editor.state.selection.from, editor.state.selection.to, From 3da4234bd75b7e018e7287332da8cd5b1e8e9828 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 14 Nov 2024 11:33:23 -0800 Subject: [PATCH 16/24] create 'useIsOSREnabled' --- core/protocol/ideWebview.ts | 3 +- .../toolWindow/ContinueBrowser.kt | 2 +- gui/src/components/mainInput/TipTapEditor.tsx | 7 +++-- .../mainInput/handleMetaKeyIssues.ts | 30 ++++--------------- gui/src/hooks/useIsOSREnabled.ts | 21 +++++++++++++ 5 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 gui/src/hooks/useIsOSREnabled.ts diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index d34b01d12..93d2192e9 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -37,7 +37,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { insertAtCursor: [{ text: string }, void]; copyText: [{ text: string }, void]; "jetbrains/editorInsetHeight": [{ height: number }, void]; - "jetbrains/isOSREnabled": [boolean, void]; + "jetbrains/isOSREnabled": [undefined, void]; "vscode/openMoveRightMarkdown": [undefined, void]; setGitHubAuthToken: [{ token: string }, void]; acceptDiff: [{ filepath: string }, void]; @@ -104,6 +104,7 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { setTheme: [{ theme: any }, void]; setColors: [{ [key: string]: string }, void]; "jetbrains/editorInsetRefresh": [undefined, void]; + "jetbrains/isOSREnabled": [boolean, void]; addApiKey: [undefined, void]; setupLocalConfig: [undefined, void]; incrementFtc: [undefined, void]; diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index bd76f910b..26896906b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -135,7 +135,7 @@ class ContinueBrowser(val project: Project, url: String) { } "jetbrains/isOSREnabled" -> { - respond(isOSREnabled) + sendToWebview( "jetbrains/isOSREnabled", isOSREnabled) } "onLoad" -> { diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 0c5f36dd8..a68a4fb1d 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -64,6 +64,7 @@ import { handleVSCMetaKeyIssues, } from "./handleMetaKeyIssues"; import { ComboBoxItem } from "./types"; +import useIsOSREnabled from "../../hooks/useIsOSREnabled"; const InputBoxDiv = styled.div<{ border?: string }>` resize: none; @@ -181,6 +182,8 @@ function TipTapEditor(props: TipTapEditorProps) { const inSubmenuRef = useRef(undefined); const inDropdownRef = useRef(false); + const isOSREnabled = useIsOSREnabled(); + const enterSubmenu = async (editor: Editor, providerId: string) => { const contents = editor.getText(); const indexOfAt = contents.lastIndexOf("@"); @@ -555,9 +558,7 @@ function TipTapEditor(props: TipTapEditorProps) { if (!editorFocusedRef?.current || !isMetaEquivalentKeyPressed(e)) return; - const isOSREnabled = isJetBrains() - ? await ideMessenger.request("jetbrains/isOSREnabled", undefined) - : false; + console.log({ isOSREnabled }); if (isOSREnabled) { handleJetBrainsOSRMetaKeyIssues(e, editor); diff --git a/gui/src/components/mainInput/handleMetaKeyIssues.ts b/gui/src/components/mainInput/handleMetaKeyIssues.ts index fb9808728..35fd847c9 100644 --- a/gui/src/components/mainInput/handleMetaKeyIssues.ts +++ b/gui/src/components/mainInput/handleMetaKeyIssues.ts @@ -6,41 +6,21 @@ const isWebEnv = isWebEnvironment(); /** * This handles various keypress issues when OSR is enabled - * @param e - * @param editor */ export const handleJetBrainsOSRMetaKeyIssues = ( e: KeyboardEvent, editor: Editor, ) => { const selection = window.getSelection(); + const alter = e.shiftKey ? "extend" : "move"; const handlers: Record void> = { Backspace: () => handleJetBrainsMetaBackspace(editor), - ArrowLeft: () => - selection.modify( - e.shiftKey ? "extend" : "move", - "backward", - "lineboundary", - ), - ArrowRight: () => - selection.modify( - e.shiftKey ? "extend" : "move", - "forward", - "lineboundary", - ), - ArrowDown: () => - selection.modify( - e.shiftKey ? "extend" : "move", - "forward", - "documentboundary", - ), + ArrowLeft: () => selection.modify(alter, "backward", "lineboundary"), + ArrowRight: () => selection.modify(alter, "forward", "lineboundary"), + ArrowDown: () => selection.modify(alter, "forward", "documentboundary"), ArrowUp: () => { - selection.modify( - e.shiftKey ? "extend" : "move", - "backward", - "documentboundary", - ); + selection.modify(alter, "backward", "documentboundary"); }, }; diff --git a/gui/src/hooks/useIsOSREnabled.ts b/gui/src/hooks/useIsOSREnabled.ts new file mode 100644 index 000000000..f1e71770a --- /dev/null +++ b/gui/src/hooks/useIsOSREnabled.ts @@ -0,0 +1,21 @@ +import { useState, useEffect, useContext } from "react"; +import { isJetBrains } from "../util"; +import { useWebviewListener } from "./useWebviewListener"; +import { IdeMessengerContext } from "../context/IdeMessenger"; + +export default function useIsOSREnabled() { + const [isOSREnabled, setIsOSREnabled] = useState(false); + const ideMessenger = useContext(IdeMessengerContext); + + useWebviewListener("jetbrains/isOSREnabled", async (isOSREnabled) => { + setIsOSREnabled(isOSREnabled); + }); + + useEffect(() => { + if (isJetBrains()) { + ideMessenger.request("jetbrains/isOSREnabled", undefined); + } + }, []); + + return isOSREnabled; +} From f534820b6630809abb1f1398fed672eea841fa2d Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 14 Nov 2024 11:35:54 -0800 Subject: [PATCH 17/24] bump package.json version --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 1bf96e316..e7b6c8271 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.229", + "version": "0.9.230", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From d977ea8447af00ef6b2a0349b4cbc6ebe34f0987 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 14 Nov 2024 12:59:24 -0800 Subject: [PATCH 18/24] Update ToolTipComponent.kt --- .../continueintellijextension/editor/ToolTipComponent.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt index 30535c4d6..7890ebdba 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt @@ -88,8 +88,8 @@ class ToolTipComponent(editor: Editor, x: Int, y: Int) : val componentHorizontalPadding = 4 val buttonMargin = 4 - addToChatButton = StyledButton("Chat (${cmdCtrlChar}J)") - editButton = StyledButton("Edit (${cmdCtrlChar}I)") + addToChatButton = StyledButton("Chat (${cmdCtrlChar}+J)") + editButton = StyledButton("Edit (${cmdCtrlChar}+I)") addToChatButton.addActionListener { e: ActionEvent? -> focusContinueInput(editor.project) From 87cfdcefa1d02bd53391b572d658024047315850 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 14 Nov 2024 12:59:53 -0800 Subject: [PATCH 19/24] Update TipTapEditor.tsx --- gui/src/components/mainInput/TipTapEditor.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index a68a4fb1d..98f1b79cc 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -558,8 +558,6 @@ function TipTapEditor(props: TipTapEditorProps) { if (!editorFocusedRef?.current || !isMetaEquivalentKeyPressed(e)) return; - console.log({ isOSREnabled }); - if (isOSREnabled) { handleJetBrainsOSRMetaKeyIssues(e, editor); } else { From c9d44a17ee2d8a31400d4964042e6959ea37c0fe Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 14 Nov 2024 11:38:33 -0800 Subject: [PATCH 20/24] improv: expand typescript queries, simplify tests --- .../RootPathContextService.ts | 7 +- .../test/RootPathContextService.test.ts | 110 ++++++------ .../test/files/arrowFunctions.ts | 21 +++ .../root-path-context/test/files/class.ts | 37 ---- .../test/files/classMethods.ts | 27 +++ .../root-path-context/test/files/classes.ts | 3 + .../root-path-context/test/files/functions.ts | 21 +-- .../test/testCases/typescript.ts | 164 ++++++++++++------ .../arrow_function/typescript.scm | 77 ++++++++ .../method_definition/typescript.scm | 30 ++++ 10 files changed, 336 insertions(+), 161 deletions(-) create mode 100644 core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts delete mode 100644 core/autocomplete/context/root-path-context/test/files/class.ts create mode 100644 core/autocomplete/context/root-path-context/test/files/classMethods.ts create mode 100644 core/autocomplete/context/root-path-context/test/files/classes.ts create mode 100644 extensions/vscode/tree-sitter/root-path-context-queries/arrow_function/typescript.scm diff --git a/core/autocomplete/context/root-path-context/RootPathContextService.ts b/core/autocomplete/context/root-path-context/RootPathContextService.ts index 2602b5acf..f279b472d 100644 --- a/core/autocomplete/context/root-path-context/RootPathContextService.ts +++ b/core/autocomplete/context/root-path-context/RootPathContextService.ts @@ -39,6 +39,7 @@ export class RootPathContextService { } private static TYPES_TO_USE = new Set([ + "arrow_function", "program", "function_declaration", "function_definition", @@ -74,9 +75,9 @@ export class RootPathContextService { this.importDefinitionsService.get(filepath); break; default: - // const type = node.type; - // debugger; - // console.log(getSyntaxTreeString(node)); + const type = node.type; + debugger; + console.log(getSyntaxTreeString(node)); query = await getQueryForFile( filepath, diff --git a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts index fe81a0edd..f3a7bd097 100644 --- a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts +++ b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts @@ -3,61 +3,61 @@ import { testRootPathContext } from "./testUtils"; const TEST_CASES = [ ...TYPESCRIPT_TEST_CASES, - { - nodeType: "function_definition", - fileName: "file1.py", - language: "Python", - cursorPosition: { line: 4, character: 25 }, - definitionPositions: [ - { row: 3, column: 30 }, // Person - { row: 3, column: 42 }, // Address - ], - }, - { - nodeType: "function_definition (inside a class)", - fileName: "file1.py", - language: "Python", - cursorPosition: { line: 12, character: 33 }, - definitionPositions: [ - { row: 6, column: 21 }, // BaseClass - { row: 6, column: 33 }, // Collection - { row: 11, column: 47 }, // Person - { row: 11, column: 59 }, // Address - ], - }, - { - nodeType: "function_definition", - fileName: "file1.php", - language: "PHP", - cursorPosition: { line: 12, character: 32 }, - definitionPositions: [ - { row: 10, column: 26 }, // Person - { row: 10, column: 44 }, // Address - ], - }, - { - nodeType: "method_declaration", - fileName: "file1.php", - language: "PHP", - cursorPosition: { line: 26, character: 35 }, - definitionPositions: [ - { row: 15, column: 29 }, // BaseClass - { row: 15, column: 55 }, // FirstInterface - { row: 15, column: 72 }, // SecondInterface - { row: 25, column: 43 }, // Person - { row: 25, column: 61 }, // Address - ], - }, - { - nodeType: "function_declaration", - fileName: "file1.go", - language: "Go", - cursorPosition: { line: 7, character: 21 }, - definitionPositions: [ - { row: 6, column: 33 }, // models.User - { row: 6, column: 50 }, // models.Address - ], - }, + // { + // nodeType: "function_definition", + // fileName: "file1.py", + // language: "Python", + // cursorPosition: { line: 4, character: 25 }, + // definitionPositions: [ + // { row: 3, column: 30 }, // Person + // { row: 3, column: 42 }, // Address + // ], + // }, + // { + // nodeType: "function_definition (inside a class)", + // fileName: "file1.py", + // language: "Python", + // cursorPosition: { line: 12, character: 33 }, + // definitionPositions: [ + // { row: 6, column: 21 }, // BaseClass + // { row: 6, column: 33 }, // Collection + // { row: 11, column: 47 }, // Person + // { row: 11, column: 59 }, // Address + // ], + // }, + // { + // nodeType: "function_definition", + // fileName: "file1.php", + // language: "PHP", + // cursorPosition: { line: 12, character: 32 }, + // definitionPositions: [ + // { row: 10, column: 26 }, // Person + // { row: 10, column: 44 }, // Address + // ], + // }, + // { + // nodeType: "method_declaration", + // fileName: "file1.php", + // language: "PHP", + // cursorPosition: { line: 26, character: 35 }, + // definitionPositions: [ + // { row: 15, column: 29 }, // BaseClass + // { row: 15, column: 55 }, // FirstInterface + // { row: 15, column: 72 }, // SecondInterface + // { row: 25, column: 43 }, // Person + // { row: 25, column: 61 }, // Address + // ], + // }, + // { + // nodeType: "function_declaration", + // fileName: "file1.go", + // language: "Go", + // cursorPosition: { line: 7, character: 21 }, + // definitionPositions: [ + // { row: 6, column: 33 }, // models.User + // { row: 6, column: 50 }, // models.Address + // ], + // }, ]; describe("RootPathContextService", () => { diff --git a/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts b/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts new file mode 100644 index 000000000..02e9d7043 --- /dev/null +++ b/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts @@ -0,0 +1,21 @@ +// @ts-nocheck + +const getAddress = (person: Person): Address => { + // TODO +}; + +const logPerson = (person: Person) => { + // TODO +}; + +const getHardcodedAddress = (): Address => { + // TODO +}; + +const getAddresses = (people: Person[]): Address[] => { + // TODO +}; + +const logPersonWithAddres = (person: Person
): Person
=> { + // TODO +}; diff --git a/core/autocomplete/context/root-path-context/test/files/class.ts b/core/autocomplete/context/root-path-context/test/files/class.ts deleted file mode 100644 index b2bd4ec78..000000000 --- a/core/autocomplete/context/root-path-context/test/files/class.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { - Address, - Person, - BaseClass, - FirstInterface, - SecondInterface, - // @ts-ignore -} from "./types"; - -class Group extends BaseClass implements FirstInterface, SecondInterface { - people: Person[]; - - constructor(people: Person[]) { - super(); - this.people = people; - } - - getPersonAddress(person: Person): Address { - return person.address; - } - - getHardcodedAddress(): Address { - return { street: "123 Main St", city: "Anytown" }; - } - - addPerson(person: Person) { - this.people = [...this.people, person]; - } - - addPeople(people: Person[]) { - this.people = [...this.people, ...people]; - } - - getAddresses(people: Person[]): Address[] { - return people.map((person) => person.address); - } -} diff --git a/core/autocomplete/context/root-path-context/test/files/classMethods.ts b/core/autocomplete/context/root-path-context/test/files/classMethods.ts new file mode 100644 index 000000000..645889b79 --- /dev/null +++ b/core/autocomplete/context/root-path-context/test/files/classMethods.ts @@ -0,0 +1,27 @@ +// @ts-nocheck + +class Group { + getPersonAddress(person: Person): Address { + // TODO + } + + getHardcodedAddress(): Address { + // TODO + } + + addPerson(person: Person) { + // TODO + } + + addPeople(people: Person[]) { + // TODO + } + + getAddresses(people: Person[]): Address[] { + // TODO + } + + logPersonWithAddress(person: Person
): Person
{ + // TODO + } +} diff --git a/core/autocomplete/context/root-path-context/test/files/classes.ts b/core/autocomplete/context/root-path-context/test/files/classes.ts new file mode 100644 index 000000000..2f6b76cda --- /dev/null +++ b/core/autocomplete/context/root-path-context/test/files/classes.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +class Group extends BaseClass implements FirstInterface, SecondInterface {} diff --git a/core/autocomplete/context/root-path-context/test/files/functions.ts b/core/autocomplete/context/root-path-context/test/files/functions.ts index ec6e0dec1..11e2bf76d 100644 --- a/core/autocomplete/context/root-path-context/test/files/functions.ts +++ b/core/autocomplete/context/root-path-context/test/files/functions.ts @@ -1,32 +1,25 @@ -import { - Address, - Person, - // @ts-ignore -} from "./types"; +// @ts-nocheck function getAddress(person: Person): Address { - return person.address; + // TODO } function getFirstAddress(people: Person[]): Address { - return people[0].address; + // TODO } function logPerson(person: Person) { - console.log(`Name: ${person.name}, Age: ${person.age}`); + // TODO } function getHardcodedAddress(): Address { - return { street: "123 Main St", city: "Anytown", zipCode: "12345" }; + // TODO } function getAddresses(people: Person[]): Address[] { - return people[0].address; + // TODO } function logPersonWithAddress(person: Person
): Person
{ - console.log( - `Name: ${person.name}, Age: ${person.age}, Address: ${person.address.street}`, - ); - return person; + // TODO } diff --git a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts index 4dbe61cf2..701813a2d 100644 --- a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts +++ b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts @@ -1,50 +1,50 @@ -export const TYPESCRIPT_TEST_CASES = [ +const FUNCTIONS = [ { nodeType: "function_declaration with a param and a return type", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 7, character: 24 }, + cursorPosition: { line: 3, character: 9 }, definitionPositions: [ - { row: 6, column: 34 }, // Person - { row: 6, column: 44 }, // Address + { row: 2, column: 34 }, // Person + { row: 2, column: 44 }, // Address ], }, { nodeType: "function_declaration with array param", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 11, character: 27 }, + cursorPosition: { line: 7, character: 9 }, definitionPositions: [ - { row: 10, column: 39 }, // Person - { row: 10, column: 51 }, // Address + { row: 6, column: 39 }, // Person + { row: 6, column: 51 }, // Address ], }, { nodeType: "function_declaration without return type", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 15, character: 58 }, + cursorPosition: { line: 11, character: 9 }, definitionPositions: [ - { row: 14, column: 33 }, // Person + { row: 10, column: 33 }, // Person ], }, { nodeType: "function_declaration without params", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 19, character: 70 }, + cursorPosition: { line: 15, character: 9 }, definitionPositions: [ - { row: 18, column: 39 }, // Person + { row: 14, column: 39 }, // Person ], }, { nodeType: "function_declaration with array params and array return type", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 23, character: 27 }, + cursorPosition: { line: 19, character: 9 }, definitionPositions: [ - { row: 22, column: 36 }, // Person - { row: 22, column: 48 }, // Address + { row: 18, column: 36 }, // Person + { row: 18, column: 48 }, // Address ], }, { @@ -52,75 +52,135 @@ export const TYPESCRIPT_TEST_CASES = [ "function_declaration with generic params and generic return type", fileName: "functions.ts", language: "TypeScript", - cursorPosition: { line: 27, character: 14 }, + cursorPosition: { line: 23, character: 9 }, definitionPositions: [ - { row: 26, column: 44 }, // Person - { row: 26, column: 52 }, // Address - { row: 26, column: 62 }, // Person - { row: 26, column: 70 }, // Address + { row: 22, column: 44 }, // Person + { row: 22, column: 52 }, // Address + { row: 22, column: 62 }, // Person + { row: 22, column: 70 }, // Address + ], + }, +]; + +const ARROW_FUNCTIONS = [ + { + nodeType: "arrow_function with a param and a return type", + fileName: "arrowFunctions.ts", + language: "TypeScript", + cursorPosition: { line: 3, character: 9 }, + definitionPositions: [ + { row: 2, column: 34 }, // Person + { row: 2, column: 44 }, // Address ], }, { - nodeType: "method_declaration with a param and a return type", - fileName: "class.ts", + nodeType: "arrow_function without return type", + fileName: "arrowFunctions.ts", language: "TypeScript", - cursorPosition: { line: 18, character: 26 }, + cursorPosition: { line: 7, character: 9 }, definitionPositions: [ - { row: 9, column: 29 }, // BaseClass - { row: 9, column: 55 }, // FirstInterface - { row: 9, column: 72 }, // SecondInterface - { row: 17, column: 33 }, // Person - { row: 17, column: 43 }, // Address + { row: 6, column: 33 }, // Person + ], + }, + { + nodeType: "arrow_function without params", + fileName: "arrowFunctions.ts", + language: "TypeScript", + cursorPosition: { line: 11, character: 9 }, + definitionPositions: [ + { row: 10, column: 39 }, // Person + ], + }, + { + nodeType: "arrow_function with array params and array return type", + fileName: "arrowFunctions.ts", + language: "TypeScript", + cursorPosition: { line: 15, character: 9 }, + definitionPositions: [ + { row: 14, column: 36 }, // Person + { row: 14, column: 48 }, // Address + ], + }, + { + nodeType: "arrow_function with generic params and generic return type", + fileName: "arrowFunctions.ts", + language: "TypeScript", + cursorPosition: { line: 19, character: 9 }, + definitionPositions: [ + { row: 18, column: 43 }, // Person + { row: 18, column: 51 }, // Address + { row: 18, column: 61 }, // Person + { row: 18, column: 69 }, // Address + ], + }, +]; + +const CLASS_METHODS = [ + { + nodeType: "method_declaration with a param and a return type", + fileName: "classMethods.ts", + language: "TypeScript", + cursorPosition: { line: 4, character: 11 }, + definitionPositions: [ + { row: 3, column: 33 }, // Person + { row: 3, column: 43 }, // Address ], }, { nodeType: "method_declaration without arguments", - fileName: "class.ts", + fileName: "classMethods.ts", language: "TypeScript", - cursorPosition: { line: 22, character: 54 }, + cursorPosition: { line: 8, character: 11 }, definitionPositions: [ - { row: 9, column: 29 }, // BaseClass - { row: 9, column: 55 }, // FirstInterface - { row: 9, column: 72 }, // SecondInterface - { row: 21, column: 32 }, // Address + { row: 7, column: 32 }, // Address ], }, { nodeType: "method_declaration without return type", - fileName: "class.ts", + fileName: "classMethods.ts", language: "TypeScript", - cursorPosition: { line: 26, character: 43 }, + cursorPosition: { line: 12, character: 11 }, definitionPositions: [ - { row: 9, column: 29 }, // BaseClass - { row: 9, column: 55 }, // FirstInterface - { row: 9, column: 72 }, // SecondInterface - { row: 25, column: 26 }, // Person + { row: 11, column: 26 }, // Person ], }, { nodeType: "method_declaration with array type arguments", - fileName: "class.ts", + fileName: "classMethods.ts", language: "TypeScript", - cursorPosition: { line: 30, character: 46 }, + cursorPosition: { line: 16, character: 11 }, definitionPositions: [ - { row: 9, column: 29 }, // BaseClass - { row: 9, column: 55 }, // FirstInterface - { row: 9, column: 72 }, // SecondInterface - { row: 29, column: 26 }, // Person + { row: 15, column: 26 }, // Person ], }, { nodeType: "method_declaration with array type arguments and array type return", - fileName: "class.ts", + fileName: "classMethods.ts", language: "TypeScript", - cursorPosition: { line: 34, character: 50 }, + cursorPosition: { line: 20, character: 11 }, definitionPositions: [ - { row: 9, column: 29 }, // BaseClass - { row: 9, column: 55 }, // FirstInterface - { row: 9, column: 72 }, // SecondInterface - { row: 33, column: 29 }, // Person - { row: 33, column: 41 }, // Address + { row: 19, column: 29 }, // Person + { row: 19, column: 41 }, // Address + ], + }, + { + nodeType: + "method_declaration with with generic params and generic return type", + fileName: "classMethods.ts", + language: "TypeScript", + cursorPosition: { line: 24, character: 11 }, + definitionPositions: [ + { row: 23, column: 37 }, // Person + { row: 23, column: 45 }, // Address + { row: 23, column: 55 }, // Person + { row: 23, column: 63 }, // Address ], }, ]; + +export const TYPESCRIPT_TEST_CASES = [ + ...FUNCTIONS, + ...ARROW_FUNCTIONS, + ...CLASS_METHODS, +]; diff --git a/extensions/vscode/tree-sitter/root-path-context-queries/arrow_function/typescript.scm b/extensions/vscode/tree-sitter/root-path-context-queries/arrow_function/typescript.scm new file mode 100644 index 000000000..159ff63f6 --- /dev/null +++ b/extensions/vscode/tree-sitter/root-path-context-queries/arrow_function/typescript.scm @@ -0,0 +1,77 @@ +; Pattern for return type with direct type_identifier +( + (arrow_function + (type_annotation + (type_identifier) @return_type + ) + ) +) + +; Pattern for return type with one level of nesting +( + (arrow_function + (type_annotation + (_ + (type_identifier) @param_type + ) + ) + ) +) + +; Pattern for return type with two levels of nesting +( + (arrow_function + (type_annotation + (_ + (_ + (type_identifier) @return_type + ) + ) + ) + ) +) + +; Pattern for parameters with direct type_identifier +( + (arrow_function + (formal_parameters + (_ + (type_annotation + (type_identifier) @param_type + ) + ) + ) + ) +) + +; Pattern for parameters with one level of nesting +( + (arrow_function + (formal_parameters + (_ + (type_annotation + (_ + (type_identifier) @param_type + ) + ) + ) + ) + ) +) + +; Pattern for parameters with two levels of nesting +( + (arrow_function + (formal_parameters + (_ + (type_annotation + (_ + (_ + (type_identifier) @param_type + ) + ) + ) + ) + ) + ) +) \ No newline at end of file diff --git a/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm b/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm index 545d11d97..d5d4c3724 100644 --- a/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm +++ b/extensions/vscode/tree-sitter/root-path-context-queries/method_definition/typescript.scm @@ -18,6 +18,19 @@ ) ) +; Pattern for return type with two levels of nesting +( + (method_definition + (type_annotation + (_ + (_ + (type_identifier) @param_type + ) + ) + ) + ) +) + ; Pattern for parameters with direct type_identifier ( (method_definition @@ -45,3 +58,20 @@ ) ) ) + +; Pattern for parameters with two levels of nesting +( + (method_definition + (formal_parameters + (_ + (type_annotation + (_ + (_ + (type_identifier) @param_type + ) + ) + ) + ) + ) + ) +) \ No newline at end of file From e74cf2cf64d2907be3aea32633d45db8947db5f2 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 14 Nov 2024 13:35:50 -0800 Subject: [PATCH 21/24] Update gradle.properties --- extensions/intellij/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 5dba42f8e..be8b0febb 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginName=continue-intellij-extension pluginRepositoryUrl=https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion=0.0.81 +pluginVersion=0.0.82 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension From 2761717b3e46b3489eea5b6ce3d9817360d4f1c9 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 14 Nov 2024 13:38:15 -0800 Subject: [PATCH 22/24] test: typescript definitions --- .../test/files/arrowFunctions.ts | 4 ++ .../test/files/classMethods.ts | 4 ++ .../root-path-context/test/files/functions.ts | 4 ++ .../test/testCases/typescript.ts | 37 +++++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts b/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts index 02e9d7043..42ef247b0 100644 --- a/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts +++ b/core/autocomplete/context/root-path-context/test/files/arrowFunctions.ts @@ -19,3 +19,7 @@ const getAddresses = (people: Person[]): Address[] => { const logPersonWithAddres = (person: Person
): Person
=> { // TODO }; + +const logPersonOrAddress = (person: Person | Address): Person | Address => { + // TODO +}; diff --git a/core/autocomplete/context/root-path-context/test/files/classMethods.ts b/core/autocomplete/context/root-path-context/test/files/classMethods.ts index 645889b79..36224029b 100644 --- a/core/autocomplete/context/root-path-context/test/files/classMethods.ts +++ b/core/autocomplete/context/root-path-context/test/files/classMethods.ts @@ -24,4 +24,8 @@ class Group { logPersonWithAddress(person: Person
): Person
{ // TODO } + + logPersonOrAddress(person: Person | Address): Person | Address { + // TODO + } } diff --git a/core/autocomplete/context/root-path-context/test/files/functions.ts b/core/autocomplete/context/root-path-context/test/files/functions.ts index 11e2bf76d..4189f4e20 100644 --- a/core/autocomplete/context/root-path-context/test/files/functions.ts +++ b/core/autocomplete/context/root-path-context/test/files/functions.ts @@ -23,3 +23,7 @@ function getAddresses(people: Person[]): Address[] { function logPersonWithAddress(person: Person
): Person
{ // TODO } + +function logPersonOrAddress(person: Person | Address): Person | Address { + // TODO +} diff --git a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts index 701813a2d..9c490ae23 100644 --- a/core/autocomplete/context/root-path-context/test/testCases/typescript.ts +++ b/core/autocomplete/context/root-path-context/test/testCases/typescript.ts @@ -60,6 +60,19 @@ const FUNCTIONS = [ { row: 22, column: 70 }, // Address ], }, + { + nodeType: + "function_declaration with union type params and union return type", + fileName: "functions.ts", + language: "TypeScript", + cursorPosition: { line: 27, character: 9 }, + definitionPositions: [ + { row: 26, column: 42 }, // Person + { row: 26, column: 52 }, // Address + { row: 26, column: 61 }, // Person + { row: 26, column: 71 }, // Address + ], + }, ]; const ARROW_FUNCTIONS = [ @@ -113,6 +126,18 @@ const ARROW_FUNCTIONS = [ { row: 18, column: 69 }, // Address ], }, + { + nodeType: "arrow_function with union type params and union return type", + fileName: "arrowFunctions.ts", + language: "TypeScript", + cursorPosition: { line: 23, character: 9 }, + definitionPositions: [ + { row: 22, column: 42 }, // Person + { row: 22, column: 52 }, // Address + { row: 22, column: 61 }, // Person + { row: 22, column: 71 }, // Address + ], + }, ]; const CLASS_METHODS = [ @@ -177,6 +202,18 @@ const CLASS_METHODS = [ { row: 23, column: 63 }, // Address ], }, + { + nodeType: "method_declaration with union type params and union return type", + fileName: "classMethods.ts", + language: "TypeScript", + cursorPosition: { line: 28, character: 11 }, + definitionPositions: [ + { row: 27, column: 35 }, // Person + { row: 27, column: 45 }, // Address + { row: 27, column: 54 }, // Person + { row: 27, column: 64 }, // Address + ], + }, ]; export const TYPESCRIPT_TEST_CASES = [ From 553c751562afb736fb914549ba3d2c75e5a4b305 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 14 Nov 2024 14:42:19 -0800 Subject: [PATCH 23/24] fix: restore tests --- .../test/RootPathContextService.test.ts | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts index f3a7bd097..fe81a0edd 100644 --- a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts +++ b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts @@ -3,61 +3,61 @@ import { testRootPathContext } from "./testUtils"; const TEST_CASES = [ ...TYPESCRIPT_TEST_CASES, - // { - // nodeType: "function_definition", - // fileName: "file1.py", - // language: "Python", - // cursorPosition: { line: 4, character: 25 }, - // definitionPositions: [ - // { row: 3, column: 30 }, // Person - // { row: 3, column: 42 }, // Address - // ], - // }, - // { - // nodeType: "function_definition (inside a class)", - // fileName: "file1.py", - // language: "Python", - // cursorPosition: { line: 12, character: 33 }, - // definitionPositions: [ - // { row: 6, column: 21 }, // BaseClass - // { row: 6, column: 33 }, // Collection - // { row: 11, column: 47 }, // Person - // { row: 11, column: 59 }, // Address - // ], - // }, - // { - // nodeType: "function_definition", - // fileName: "file1.php", - // language: "PHP", - // cursorPosition: { line: 12, character: 32 }, - // definitionPositions: [ - // { row: 10, column: 26 }, // Person - // { row: 10, column: 44 }, // Address - // ], - // }, - // { - // nodeType: "method_declaration", - // fileName: "file1.php", - // language: "PHP", - // cursorPosition: { line: 26, character: 35 }, - // definitionPositions: [ - // { row: 15, column: 29 }, // BaseClass - // { row: 15, column: 55 }, // FirstInterface - // { row: 15, column: 72 }, // SecondInterface - // { row: 25, column: 43 }, // Person - // { row: 25, column: 61 }, // Address - // ], - // }, - // { - // nodeType: "function_declaration", - // fileName: "file1.go", - // language: "Go", - // cursorPosition: { line: 7, character: 21 }, - // definitionPositions: [ - // { row: 6, column: 33 }, // models.User - // { row: 6, column: 50 }, // models.Address - // ], - // }, + { + nodeType: "function_definition", + fileName: "file1.py", + language: "Python", + cursorPosition: { line: 4, character: 25 }, + definitionPositions: [ + { row: 3, column: 30 }, // Person + { row: 3, column: 42 }, // Address + ], + }, + { + nodeType: "function_definition (inside a class)", + fileName: "file1.py", + language: "Python", + cursorPosition: { line: 12, character: 33 }, + definitionPositions: [ + { row: 6, column: 21 }, // BaseClass + { row: 6, column: 33 }, // Collection + { row: 11, column: 47 }, // Person + { row: 11, column: 59 }, // Address + ], + }, + { + nodeType: "function_definition", + fileName: "file1.php", + language: "PHP", + cursorPosition: { line: 12, character: 32 }, + definitionPositions: [ + { row: 10, column: 26 }, // Person + { row: 10, column: 44 }, // Address + ], + }, + { + nodeType: "method_declaration", + fileName: "file1.php", + language: "PHP", + cursorPosition: { line: 26, character: 35 }, + definitionPositions: [ + { row: 15, column: 29 }, // BaseClass + { row: 15, column: 55 }, // FirstInterface + { row: 15, column: 72 }, // SecondInterface + { row: 25, column: 43 }, // Person + { row: 25, column: 61 }, // Address + ], + }, + { + nodeType: "function_declaration", + fileName: "file1.go", + language: "Go", + cursorPosition: { line: 7, character: 21 }, + definitionPositions: [ + { row: 6, column: 33 }, // models.User + { row: 6, column: 50 }, // models.Address + ], + }, ]; describe("RootPathContextService", () => { From 067a3a843baf5a0e12bd5b6f21f37a504836286c Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 14 Nov 2024 14:42:42 -0800 Subject: [PATCH 24/24] fix: restore comments --- .../context/root-path-context/RootPathContextService.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/autocomplete/context/root-path-context/RootPathContextService.ts b/core/autocomplete/context/root-path-context/RootPathContextService.ts index f279b472d..b4b742911 100644 --- a/core/autocomplete/context/root-path-context/RootPathContextService.ts +++ b/core/autocomplete/context/root-path-context/RootPathContextService.ts @@ -75,9 +75,9 @@ export class RootPathContextService { this.importDefinitionsService.get(filepath); break; default: - const type = node.type; - debugger; - console.log(getSyntaxTreeString(node)); + // const type = node.type; + // debugger; + // console.log(getSyntaxTreeString(node)); query = await getQueryForFile( filepath,