Merge branch 'main' into pe/tsc-fix-find-widget

This commit is contained in:
Test 2024-11-15 12:14:24 -08:00
commit 1328f75e6f
25 changed files with 659 additions and 209 deletions

View file

@ -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": {
@ -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"
@ -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": {

View file

@ -39,6 +39,7 @@ export class RootPathContextService {
}
private static TYPES_TO_USE = new Set([
"arrow_function",
"program",
"function_declaration",
"function_definition",
@ -90,15 +91,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;
}

View file

@ -0,0 +1,25 @@
// @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<Address>): Person<Address> => {
// TODO
};
const logPersonOrAddress = (person: Person | Address): Person | Address => {
// TODO
};

View file

@ -1,33 +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];
}
}

View file

@ -0,0 +1,31 @@
// @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<Address>): Person<Address> {
// TODO
}
logPersonOrAddress(person: Person | Address): Person | Address {
// TODO
}
}

View file

@ -0,0 +1,3 @@
// @ts-nocheck
class Group extends BaseClass implements FirstInterface, SecondInterface {}

View file

@ -1,25 +1,29 @@
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<Address>): Person<Address> {
// TODO
}
function logPersonOrAddress(person: Person | Address): Person | Address {
// TODO
}

View file

@ -1,89 +1,223 @@
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: "method_declaration",
fileName: "class.ts",
nodeType: "function_declaration with array params and array return type",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 18, character: 26 },
cursorPosition: { line: 19, 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: 18, column: 36 }, // Person
{ row: 18, column: 48 }, // Address
],
},
{
nodeType:
"function_declaration with generic params and generic return type",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 23, character: 9 },
definitionPositions: [
{ row: 22, column: 44 }, // Person
{ row: 22, column: 52 }, // Address
{ row: 22, column: 62 }, // Person
{ 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 = [
{
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: "arrow_function without return type",
fileName: "arrowFunctions.ts",
language: "TypeScript",
cursorPosition: { line: 7, character: 9 },
definitionPositions: [
{ 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
],
},
{
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 = [
{
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: "classMethods.ts",
language: "TypeScript",
cursorPosition: { line: 20, character: 11 },
definitionPositions: [
{ 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
],
},
{
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 = [
...FUNCTIONS,
...ARROW_FUNCTIONS,
...CLASS_METHODS,
];

89
core/package-lock.json generated
View file

@ -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": {
@ -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",
@ -7331,27 +7339,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": {
@ -10868,12 +10876,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",
@ -10910,6 +10912,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",
@ -11068,28 +11084,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",
@ -11293,15 +11298,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 +11316,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",
@ -12253,7 +12251,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"
},

View file

@ -38,6 +38,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
insertAtCursor: [{ text: string }, void];
copyText: [{ text: string }, void];
"jetbrains/editorInsetHeight": [{ height: number }, void];
"jetbrains/isOSREnabled": [undefined, void];
"vscode/openMoveRightMarkdown": [undefined, void];
setGitHubAuthToken: [{ token: string }, void];
acceptDiff: [{ filepath: string; streamId?: string }, void];
@ -110,6 +111,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];

View file

@ -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<RangeInFile[]> {
throw new Error("Method not implemented.");
return Promise.resolve([]);
}
onDidChangeActiveTextEditor(callback: (filepath: string) => void): void {
return;

View file

@ -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")

View file

@ -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

View file

@ -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)

View file

@ -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" -> {
sendToWebview( "jetbrains/isOSREnabled", isOSREnabled)
}
"onLoad" -> {
coroutineScope.launch {
// Set the colors to match Intellij theme

View file

@ -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",

View file

@ -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"
@ -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",

View file

@ -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
)
)
)
)
)
)
)

View file

@ -1,7 +1,33 @@
; 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 return type with two levels of nesting
(
(function_declaration
(type_annotation
(_
(_
(type_identifier) @return_type
)
)
)
)
)
@ -31,4 +57,21 @@
)
)
)
)
; Pattern for parameters with two levels of nesting
(
(function_declaration
(formal_parameters
(_
(type_annotation
(_
(_
(type_identifier) @param_type
)
)
)
)
)
)
)

View file

@ -1,7 +1,33 @@
; 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
)
)
)
)
; Pattern for return type with two levels of nesting
(
(method_definition
(type_annotation
(_
(_
(type_identifier) @param_type
)
)
)
)
)
@ -32,3 +58,20 @@
)
)
)
; Pattern for parameters with two levels of nesting
(
(method_definition
(formal_parameters
(_
(type_annotation
(_
(_
(type_identifier) @param_type
)
)
)
)
)
)
)

View file

@ -60,10 +60,11 @@ import {
getSlashCommandDropdownOptions,
} from "./getSuggestion";
import {
handleJetBrainsMetaKeyPress,
handleMetaKeyPress,
} from "./handleMetaKeyPress";
handleJetBrainsOSRMetaKeyIssues,
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<string | undefined>(undefined);
const inDropdownRef = useRef(false);
const isOSREnabled = useIsOSREnabled();
const enterSubmenu = async (editor: Editor, providerId: string) => {
const contents = editor.getText();
const indexOfAt = contents.lastIndexOf("@");
@ -551,17 +554,14 @@ function TipTapEditor(props: TipTapEditorProps) {
* with those key actions.
*/
const handleKeyDown = async (e: KeyboardEvent<HTMLDivElement>) => {
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);
if (isOSREnabled) {
handleJetBrainsOSRMetaKeyIssues(e, editor);
} else {
await handleVSCMetaKeyIssues(e, editor);
}
};

View file

@ -1,41 +1,26 @@
import { Editor } from "@tiptap/react";
import { KeyboardEvent } from "react";
import { isWebEnvironment } from "../../util";
import { Editor } from "@tiptap/react";
const isWebEnv = isWebEnvironment();
export const handleJetBrainsMetaKeyPress = (
/**
* This handles various keypress issues when OSR is enabled
*/
export const handleJetBrainsOSRMetaKeyIssues = (
e: KeyboardEvent,
editor: Editor,
) => {
const selection = window.getSelection();
const alter = e.shiftKey ? "extend" : "move";
const handlers: Record<string, () => 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");
},
};
@ -46,7 +31,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,

View file

@ -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;
}

View file

@ -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:

View file

@ -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",
},
};