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
16.44k stars 1.28k forks source link

Slash commands not working in IntelliJ #2390

Open martinack opened 3 days ago

martinack commented 3 days ago

Before submitting your bug report

Relevant environment info

- OS: Ubuntu 24.04.1 LTS
- Continue: 0.0.69
- IDE: IntelliJ IDEA 2024.2.2 (Ultimate Edition) - Build #IU-242.22855.74
- Model: Meta lLama3
- config.json:

{
  "models": [
    {
      "title": "Meta lLama3",
      "provider": "ollama",
      "model": "llama3:latest",
      "apiBase": "...",
      "requestOptions": {
        "headers": {
          "X-API-Key": "..."
        }
      }
    }
  ],
  "tabAutocompleteModel": {
    "title": "Meta lLama3",
    "provider": "ollama",
    "model": "llama3:latest",
    "apiBase": "...",
    "requestOptions": {
      "headers": {
        "X-API-Key": "..."
      }
    }
  },
  "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"
    },
    {
      "name": "javadoc",
      "prompt": "{{{ input }}}\n\nGenerate the javadoc the selected code. Ready for copy paste {{{ open }}}",
      "description": "Write javadocs for highlighted code"
    }
  ],
  "contextProviders": [
    { "name": "codebase" },
    { "name": "file" },
    { "name": "code" },
    { "name": "open" },
    { "name": "folder" },
    { "name": "search" },
    { "name": "diff" }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "commit",
      "description": "Generate a git commit message"
    },
    {
      "name": "onboard",
      "description": "Familiarize yourself with the codebase"
    }
  ]
}

Description

The slash commands are not working (for me) in IntelliJ. The suggestion shows the commands in capital case. The commands are not resolved to commands, but sent as input to the AI, most likely because they are used in capital case (as the ui suggests).

The same config works in VS Code.

Prepending a space to custom commands causes them to work, e.g. " javadoc".

To reproduce

In the chat window: image image image

Another example: image

Log output

//core.log
[info] Starting Continue core...
[2024-09-25T08:33:00] [info] Starting Continue core... 
[2024-09-25T08:33:00] Setup 
[2024-09-25T08:33:00] Core started 
[2024-09-25T08:33:00] Indexing: 0.0% complete, elapsed time: 0s, NaN file/sec 
[2024-09-25T08:33:01] LanceDBIndex, skipping [filepath]/solr/instances/default/solr.p12: Error: did not chunk properly 
[2024-09-25T08:33:01] error when indexing:  Error: Failed to generate embeddings for 546 chunks with provider: _TransformersJsEmbeddingsProvider::all-MiniLM-L6-v2: Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/snapshot/continue/binary/models/all-MiniLM-L6-v2/tokenizer.json".
[2024-09-25T08:33:01] Indexing failed with error:  Error: Failed to generate embeddings for 546 chunks with provider: _TransformersJsEmbeddingsProvider::all-MiniLM-L6-v2: Error: `local_files_only=true` or `env.allowRemoteModels=false` and file was not found locally at "/snapshot/continue/binary/models/all-MiniLM-L6-v2/tokenizer.json". LanceDbIndex.getEmbeddings, process.processTicksAndRejections, async LanceDbIndex.computeRows, async LanceDbIndex.update, async CodebaseIndexer.indexFiles, async CodebaseIndexer.refresh, async Core.refreshCodebaseIndex
[2024-09-25T08:33:11] (node:289558) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `continue-binary --trace-warnings ...` to show where the warning was created)

//prompt.log (from the example above)
Settings:
contextLength: 8096
model: llama3:latest
maxTokens: 2048
log: undefined

############################################

<user>
/Edit [filename]ProductFacade.java (81-81)
Product product = null;

add final modifier

Completion:

assistant

Here is the edited code:

public final class ProductFacade { // (81-81) public final Product product = null; }


I added the `final` modifier to the `product` variable declaration. Let me know if you need any further changes!
Patrick-Erichsen commented 3 days ago

Hi @martinack , thanks for the heads up here, this has been fixed in VS Code but not rolled out to JetBrains yet. Will plan to ship a hotfix soon 👍