Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIM+Ollama+qwen2.5+Repository level] RangeError: path should be a path.relative()d string #426

Open
derjanb opened this issue Dec 20, 2024 · 0 comments

Comments

@derjanb
Copy link

derjanb commented Dec 20, 2024

Describe the bug
When enabling "Repository level" then I get RangeError: path should be a "path.relative()"d string, but got "/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js"

To Reproduce
Enable "Repository level", use model, provider, ... as described below.

Expected behavior
No error ;-)

Logging

2024-12-20 00:40:57.647 [error] RangeError: path should be a `path.relative()`d string, but got "/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js"
	at throwError2 (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:20756:13)
	at checkPath (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:20770:16)
	at Ignore2._test (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:20858:9)
	at Ignore2.ignores (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:20885:21)
	at /home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:69747:28
	at Array.filter (<anonymous>)
	at CompletionProvider.getRelevantDocuments (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:69744:49)
	at CompletionProvider.getPrompt (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:69866:46)
	at async CompletionProvider.provideInlineCompletionItems (/home/user/.vscode/extensions/rjmacarthy.twinny-3.20.4/out/index.js:69592:20)
	at async tU.provideInlineCompletions (file:///usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:139184)

API Provider
Ollama

Chat or Auto Complete?
FIM

Model Name
qwen2.5-code:7b-base

Desktop (please complete the following information):

  • OS: Ubuntu 22.04.5

Additional context
I fixed it this way, but I have not enough knowledge (yet) to decide whether this is correct:

diff --git a/src/extension/providers/completion.ts b/src/extension/providers/completion.ts
index 9d76a7e..4c5e51c 100644
--- a/src/extension/providers/completion.ts
+++ b/src/extension/providers/completion.ts
@@ -393,7 +393,7 @@ export class CompletionProvider
     const currentFileName = this._document?.fileName || ""
     const openTextDocuments = workspace.textDocuments
     const rootPath = workspace.workspaceFolders?.[0]?.uri.fsPath || ""
-    const ig = ignore()
+    const ig = ignore({ allowRelativePaths: true })
 
     const embeddingIgnoredGlobs = this.config.get(
       "embeddingIgnoredGlobs",

package-lock.json:

[...]
    "node_modules/ignore": {
      "version": "6.0.2",
      "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz",
      "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==",
      "engines": {
        "node": ">= 4"
      }
    },
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant