Closed
Description
Issue Type: Bug
-
Create a new Typescript extension with
yo code
. -
In package.json, replace the
actionEvents
field with"activationEvents": [ "*" ],
-
Replace extension.ts with the following code:
import * as vscode from 'vscode'; export function activate(context: vscode.ExtensionContext) { let provider = vscode.languages.registerCompletionItemProvider("plaintext", { provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext){ return [ { label:"C", detail:"Should show above the B", sortText :"A" }, { label:"B", detail:"Should show below the C", } ] } }); context.subscriptions.push(provider); } export function deactivate() {}
-
Run the extension and create a new txt file.
-
Press ctrl+space to show completion options.
What I expected:
The 'C'
option will be sorted to be shown above the 'B'
option, because it has a sortText
of 'A'
.
What actually happened:
The 'C'
option will be sorted to be shown below the 'B'
option, because its sortText
is being ignored and the label
is used for sorting instead.
You can see that if you just add a sortText of 'B' to 'B' it works as expected.
{
label:"C",
detail:"Should show above the B",
sortText :"A"
},
{
label:"B",
detail:"Should show below the C",
sortText:"B"
}
VS Code version: Code - Insiders 1.31.0-insider (bae6c84, 2019-01-04T06:17:20.719Z)
OS version: Windows_NT x64 10.0.17134
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-4700HQ CPU @ 2.40GHz (8 x 2394) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled surface_synchronization: enabled_on video_decode: enabled webgl: enabled webgl2: enabled |
Memory (System) | 15.91GB (10.39GB free) |
Process Argv | |
Screen Reader | no |
VM | 50% |