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

CompletionItem.sortText is not respected #103682

Closed
octref opened this issue Jul 31, 2020 · 2 comments
Closed

CompletionItem.sortText is not respected #103682

octref opened this issue Jul 31, 2020 · 2 comments
Assignees
Labels
*dev-question VS Code Extension Development Question

Comments

@octref
Copy link
Contributor

octref commented Jul 31, 2020

Version: 1.47.3
Commit: 91899dc
Date: 2020-07-23T13:08:29.692Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0


  1. Copy below code to https://github.com/microsoft/vscode-extension-samples/tree/master/helloworld-minimal-sample
  2. Open a plaintext file. Enter a dot .
  3. Complete
const vscode = require('vscode');

function activate(context) {
  vscode.languages.registerCompletionItemProvider('plaintext', {
    provideCompletionItems() {
      return [
        {
          label: 'pp',
          sortText: '01',
          kind: 5,
        },
        {
          label: 'pp-1',
          filterText: '.pp-1',
          sortText: '02',
          kind: 5,
          textEdit: {
            range: {
              start: { line: 0, character: 0 },
              end: { line: 0, character: 1 },
            },
            newText: '.pp-1',
          },
        },
      ];
    },
  });
}

module.exports = {
  activate,
};

Expected: pp show up before pp-1, as '01' < '02'
Actual:

image

Related: vuejs/vetur#1804

@jrieken

@jrieken
Copy link
Member

jrieken commented Aug 10, 2020

The sortText is only respected when no prefix is selected and since the latter item selects a prefix a score is computed and assigned.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*dev-question VS Code Extension Development Question
Projects
None yet
Development

No branches or pull requests

3 participants
@jrieken @octref and others