continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
19.65k stars 1.72k forks source link

Issues with slashCommands in VsCode #2462

Open aakashparsi opened 1 month ago

aakashparsi commented 1 month ago

Before submitting your bug report

Relevant environment info

- OS: Windows 11
- Continue: v0.8.52
- IDE: VSCode 1.94.0
- Model: Ollama v0.3.10
- config.json:

     {
  "models": [
    {
      "model": "qwen2.5:7b-instruct-q4_K_M",
      "title": "Ollama (Remote)",
      "completionOptions": {},
      "apiBase": "http://localhost:3000/ollama",
      "apiKey":"<API KEY>",
      "provider": "ollama",
      "useLegacyCompletionsEndpoint": false
    }
  ],
  "systemMessage": "You are a coding assistant for the user. Your task is to help the users with the any kind of programming or coding questions only. Do not respond to non-programming or non-coding questions like 'Tell me a joke' or 'what is the capital city of india' etc ",
  "completionOptions": {
    "temperature": 0,
    "topP": 1,
    "topK": null,
    "presencePenalty": null,
    "frequencyPenalty": null,
    "stop": null,
    "maxTokens": 600,
    "stream": true
  },
  "tabAutocompleteModel": {
      "model": "qwen2.5:7b-instruct-q4_K_M",
      "title": "Ollama (Remote)",
      "completionOptions": {},
      "apiBase": "http://localhost:3000/ollama",
      "apiKey":"<API KEY>",
      "provider": "ollama",
      "useLegacyCompletionsEndpoint": false
  },
  "customCommands": [
    {
      "name": "test",
      "prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "contextProviders": [
    {
      "name": "code",
      "params": {}
    },
    {
      "name": "docs",
      "params": {}
    },
    {
      "name": "diff",
      "params": {}
    },
    {
      "name": "terminal",
      "params": {}
    },
    {
      "name": "problems",
      "params": {}
    },
    {
      "name": "folder",
      "params": {}
    },
    {
      "name": "codebase",
      "params": {}
    }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "share",
      "description": "Export the current chat session to markdown"
    },
    {
      "name": "cmd",
      "description": "Generate a shell command"
    },
    {
      "name": "commit",
      "description": "Generate a git commit message"
    }
  ]
}

### Description

Facing issues to run the slashCommands in the windows machine.

**Error message:** ENOENT: no such file or directory, open 'C:\Untitled-1'

Upon checking the logs from the developer tools. I was able to find the below message

Extension Host] Error handling webview message: { "msg": { "messageId": "c7bbbf6d-e918-4194-a32a-957e2ea6bfbe", "messageType": "command/run", "data": { "input": "/edit Untitled-1 (1-2)\ndef is_even(n):\r\n return n%2==0\n", "history": [ { "role": "user", "content": "Take the file prefix and suffix into account, but only rewrite the code_to_edit as specified in the user_request. The code you write in modified_code_to_edit will replace the code between the code_to_edit tags. Do NOT preface your answer or write anything other than code. The tag should be written to indicate the end of the modified code section. Do not ever use nested tags.\n\nExample:\n\n\nclass Database:\n def init(self):\n self._data = {{}}\n\n def get(self, key):\n return self._data[key]\n\n\n\n def set(self, key, value):\n self._data[key] = value\n\n\n\n def clear_all():\n self._data = {{}}\n\n\nRaise an error if the key already exists.\n\n\n def set(self, key, value):\n if key in self._data:\n raise KeyError(f\"Key {{key}} already exists\")\n self._data[key] = value\n\n\nMain task:\n\n\ndef is_even(n):\r\n return n%2==0\n\n\n/edit Untitled-1 (1-2)\ndef is_even(n):\r\n return n%2==0\n\n\n\n" } ], "modelTitle": "Ollama (Remote)", "slashCommandName": "edit", "contextItems": [ { "content": "def is_even(n):\r\n return n%2==0", "name": "Untitled-1 (1-2)", "description": "Untitled-1 (1-2)", "id": { "providerTitle": "code", "itemId": "Untitled-1" }, "editing": true } ], "historyIndex": 0, "selectedCode": [ { "filepath": "Untitled-1 (1-2)", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 1, "character": 0 } } } ] } } }

EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open 'C:\Untitled-1'



### To reproduce

_No response_

### Log output

_No response_
aakash-parsi commented 1 month ago

Solution:

It is mandatory to save the file before using slashCommands.