TabbyML / tabby

Self-hosted AI coding assistant
https://tabby.tabbyml.com/
Other
21.56k stars 984 forks source link

VSCode code inline completion with wrong indentation size #3263

Open Sma1lboy opened 1 week ago

Sma1lboy commented 1 week ago

Describe the bug Sometimes, the code completion hint is not formatted according to the context above or below.

image

Information about your version Please provide output of tabby --version tabby 0.17.0

icycodes commented 1 week ago

Could you provide a detailed log referencing this completion request? It will be very helpful to address the problem.
You can find it at http://localhost:8080/activities (please replace the host and port if you are not using the default local setup). Please unfold the Completion event and copy the full JSON.

Sma1lboy commented 1 week ago

I have performed this test multiple times. I apologize for the messy data here. Thank you for your help.

    "completion": {
      "completion_id": "cmpl-51f901f2-7369-41f5-9554-fee0e27830a7",
      "language": "json",
      "prompt": "<fim_prefix>  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        <fim_suffix>\n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n        \"title\": \"Set Token...\",\n<fim_middle>",
      "segments": {
        "prefix": "  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        ",
        "suffix": "\n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n        \"title\": \"Set Token...\",\n",
        "git_url": "git@github.com:Sma1lboy/tabby.git",
        "filepath": "clients/vscode/package.json"
      },
      "choices": [
        {
          "index": 0,
          "text": "\"title\":  \"Run Test\",\n         \"category\":  \"Tabby\""
        }
      ],
      "user_agent": "Node.js/v20.14.0 tabby-agent/1.8.0-dev Visual-Studio-Code-desktop/1.92.2 TabbyML.vscode-tabby/1.12.1"
    }
    "completion": {
      "completion_id": "cmpl-c6d0dbba-830c-447e-b2f4-419b8423f4fe",
      "language": "json",
      "prompt": "<fim_prefix>  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        <fim_suffix>\n\n        \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n<fim_middle>",
      "segments": {
        "prefix": "  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        ",
        "suffix": "\n\n        \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n",
        "git_url": "git@github.com:Sma1lboy/tabby.git",
        "filepath": "clients/vscode/package.json"
      },
      "choices": [
        {
          "index": 0,
          "text": "\"title\":  \"Run Test\",\n         \"category\":  \"Tabby\"\n       },\n       {\n         \"command\": \"tabby.server.stop\",\n         \"title\":  \"Stop Server\",\n         \"category\":  \"Tabby\"\n       },\n       {\n         \"command\": \"tabby.server"
        }
      ],
      "user_agent": "Node.js/v20.14.0 tabby-agent/1.8.0-dev Visual-Studio-Code-desktop/1.92.2 TabbyML.vscode-tabby/1.12.1"
    }
    "completion": {
      "completion_id": "cmpl-f1711309-0719-4c69-b305-a998009337ec",
      "language": "json",
      "prompt": "<fim_prefix>  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n      <fim_suffix>        \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n        \"title\": \"Set Token...\",\n<fim_middle>",
      "segments": {
        "prefix": "  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n      ",
        "suffix": "        \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n        \"title\": \"Set Token...\",\n",
        "git_url": "git@github.com:Sma1lboy/tabby.git",
        "filepath": "clients/vscode/package.json"
      },
      "choices": [
        {
          "index": 0,
          "text": "   \"title\":  \"Run Test\",\n         \"category\":  \"Tabby\"\n       },\n       {\n         \"command\":  \"tabby.server.stop\",\n         \"title\":  \"Stop Server\",\n         \"category\":  \"Tabby\"\n       },\n       {\n         \"command\":  \"tab"
        }
      ],
      "user_agent": "Node.js/v20.14.0 tabby-agent/1.8.0-dev Visual-Studio-Code-desktop/1.92.2 TabbyML.vscode-tabby/1.12.1"
    }
    "completion": {
      "completion_id": "cmpl-3117b427-98f1-4fca-9cc6-e64578fd3f42",
      "language": "json",
      "prompt": "<fim_prefix>  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        <fim_suffix>\n              \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n<fim_middle>",
      "segments": {
        "prefix": "  ],\n  \"icon\": \"assets/logo.png\",\n  \"engines\": {\n    \"vscode\": \"^1.82.0\"\n  },\n  \"categories\": [\n    \"Programming Languages\",\n    \"Machine Learning\",\n    \"Other\"\n  ],\n  \"activationEvents\": [\n    \"onStartupFinished\"\n  ],\n  \"main\": \"./dist/node/extension.js\",\n  \"browser\": \"./dist/browser/extension.js\",\n  \"contributes\": {\n    \"commands\": [\n      {\n        \"command\": \"tabby.server.test\",\n        ",
        "suffix": "\n              \n      },\n      {\n        \"command\": \"tabby.toggleInlineCompletionTriggerMode\",\n        \"title\": \"Toggle Code Completion Trigger Mode (Automatic/Manual)\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.inlineCompletion.trigger\",\n        \"title\": \"Trigger Code Completion Manually\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiEndpoint\",\n        \"title\": \"Connect to Server...\",\n        \"category\": \"Tabby\"\n      },\n      {\n        \"command\": \"tabby.setApiToken\",\n",
        "git_url": "git@github.com:Sma1lboy/tabby.git",
        "filepath": "clients/vscode/package.json"
      },
      "choices": [
        {
          "index": 0,
          "text": "\"title\":  \"Run Test\",\n         \"category\":  \"Tabby\""
        }
      ],
      "user_agent": "Node.js/v20.14.0 tabby-agent/1.8.0-dev Visual-Studio-Code-desktop/1.92.2 TabbyML.vscode-tabby/1.12.1"
    }
  }