From 665e5e1058f79255a160e063481da8ad0824d16f Mon Sep 17 00:00:00 2001 From: nathfavour <116535483+nathfavour@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:53:35 -0800 Subject: [PATCH 1/4] open in idx --- .idx/dev.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .idx/dev.nix diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 00000000..6e2d3853 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,47 @@ +# To learn more about how to use Nix to configure your environment +# see: https://developers.google.com/idx/guides/customize-idx-env +{pkgs}: { + # Which nixpkgs channel to use. + channel = "stable-23.11"; # or "unstable" + # Use https://search.nixos.org/packages to find packages + packages = [ + pkgs.nodejs_20 + pkgs.yarn + pkgs.nodePackages.pnpm + pkgs.bun + pkgs.gh + ]; + # Sets environment variables in the workspace + env = {}; + idx = { + # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" + extensions = [ + # "vscodevim.vim" + ]; + workspace = { + # Runs when a workspace is first created with this `dev.nix` file + onCreate = { + npm-install = "npm ci --no-audit --prefer-offline --no-progress --timing"; + # Open editors for the following files by default, if they exist: + default.openFiles = [ + # Cover all the variations of language, src-dir, router (app/pages) + "pages/index.tsx" "pages/index.jsx" + "src/pages/index.tsx" "src/pages/index.jsx" + "app/page.tsx" "app/page.jsx" + "src/app/page.tsx" "src/app/page.jsx" + ]; + }; + # To run something each time the workspace is (re)started, use the `onStart` hook + }; + # Enable previews and customize configuration + previews = { + enable = true; + previews = { + web = { + command = ["npm" "run" "dev" "--" "--port" "$PORT" "--hostname" "0.0.0.0"]; + manager = "web"; + }; + }; + }; + }; +} \ No newline at end of file From aacbef3e33a31a1c9195784397e22a04b4e4d956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Commaret?= Date: Mon, 18 Nov 2024 12:58:42 +0100 Subject: [PATCH 2/4] lodash : package added to extension --- extensions/void/package-lock.json | 8 ++++++++ extensions/void/package.json | 1 + 2 files changed, 9 insertions(+) diff --git a/extensions/void/package-lock.json b/extensions/void/package-lock.json index d8e80af1..e4eb8e55 100644 --- a/extensions/void/package-lock.json +++ b/extensions/void/package-lock.json @@ -41,6 +41,7 @@ "eslint-plugin-react": "^7.35.1", "eslint-plugin-react-hooks": "^4.6.2", "globals": "^15.9.0", + "lodash": "^4.17.21", "marked": "^14.1.0", "ollama": "^0.5.9", "openai": "^4.68.4", @@ -5041,6 +5042,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/extensions/void/package.json b/extensions/void/package.json index 4a8e3995..4c5f67d2 100644 --- a/extensions/void/package.json +++ b/extensions/void/package.json @@ -143,6 +143,7 @@ "eslint-plugin-react": "^7.35.1", "eslint-plugin-react-hooks": "^4.6.2", "globals": "^15.9.0", + "lodash": "^4.17.21", "marked": "^14.1.0", "ollama": "^0.5.9", "openai": "^4.68.4", From 775cb2e4ac82143528810caf61d4b71d32f1431d Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:21:47 -0800 Subject: [PATCH 3/4] Update dev.nix --- .idx/dev.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 6e2d3853..83eb293f 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -1,3 +1,4 @@ +# Created for Void # To learn more about how to use Nix to configure your environment # see: https://developers.google.com/idx/guides/customize-idx-env {pkgs}: { @@ -44,4 +45,4 @@ }; }; }; -} \ No newline at end of file +} From 6df0093786e5f3c0d7d304fb029f3ebd19302611 Mon Sep 17 00:00:00 2001 From: mp Date: Mon, 18 Nov 2024 17:13:55 -0800 Subject: [PATCH 4/4] ui --- .../void/src/extension/AutcompleteProvider.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/extensions/void/src/extension/AutcompleteProvider.ts b/extensions/void/src/extension/AutcompleteProvider.ts index 5ca8fdac..2aad378a 100644 --- a/extensions/void/src/extension/AutcompleteProvider.ts +++ b/extensions/void/src/extension/AutcompleteProvider.ts @@ -63,7 +63,7 @@ const trimPrefix = (prefix: string) => { // originalSuffix = ijkl // the user has typed "ef" so prefix = abcdef // we want to return the rest of the generatedMiddle, which is "gh" -const toInlineCompletion = ({ prefix, autocompletion }: { prefix: string, autocompletion: Autocompletion }): vscode.InlineCompletionItem => { +const toInlineCompletion = ({ prefix, autocompletion, position }: { prefix: string, autocompletion: Autocompletion, position: vscode.Position }): vscode.InlineCompletionItem => { const originalPrefix = autocompletion.prefix const generatedMiddle = autocompletion.result @@ -83,7 +83,10 @@ const toInlineCompletion = ({ prefix, autocompletion }: { prefix: string, autoco const completionStr = generatedMiddle.substring(lastMatchupIndex) console.log('completionStr: ', completionStr) - return new vscode.InlineCompletionItem(completionStr) + return new vscode.InlineCompletionItem( + completionStr, + new vscode.Range(position, position) + ) } @@ -127,6 +130,9 @@ export class AutocompleteProvider implements vscode.InlineCompletionItemProvider token: vscode.CancellationToken, ): Promise { + const disabled = true + if (disabled) { return []; } + const docUriStr = document.uri.toString() const fullText = document.getText(); @@ -156,7 +162,7 @@ export class AutocompleteProvider implements vscode.InlineCompletionItemProvider if (cachedAutocompletion.status === 'finished') { console.log('AAA1') - const inlineCompletion = toInlineCompletion({ autocompletion: cachedAutocompletion, prefix, }) + const inlineCompletion = toInlineCompletion({ autocompletion: cachedAutocompletion, prefix, position }) return [inlineCompletion] } else if (cachedAutocompletion.status === 'pending') { @@ -164,7 +170,7 @@ export class AutocompleteProvider implements vscode.InlineCompletionItemProvider try { await cachedAutocompletion.promise; - const inlineCompletion = toInlineCompletion({ autocompletion: cachedAutocompletion, prefix, }) + const inlineCompletion = toInlineCompletion({ autocompletion: cachedAutocompletion, prefix, position }) return [inlineCompletion] } catch (e) { @@ -260,7 +266,7 @@ export class AutocompleteProvider implements vscode.InlineCompletionItemProvider try { await newAutocompletion.promise; - const inlineCompletion = toInlineCompletion({ autocompletion: newAutocompletion, prefix, }) + const inlineCompletion = toInlineCompletion({ autocompletion: newAutocompletion, prefix, position }) return [inlineCompletion] } catch (e) {