[Take Over mode][Suggestion] Add Setting to Force Suggestions Ordering
See original GitHub issueSome Background
This is a continuation of https://github.com/johnsoncodehk/volar/issues/974#issuecomment-1047105363 and comment below.
You just said
We need to be consistent with VSCode, because their designed behavior is verified by more users, and changing it in volar might be counterproductive.
However the behavior is already inconsistent, e.g. Volar is already much bettter comparing to what we have with builtin TS extension right now. I also noticed that Volar loads much faster and overall has better performance.
I have a repo, where builtin TS extension gives false errors (suppose just crashes) on pnpm start
until I restart the server and this is not a case with your Volar.
So I always recommend to everyone to disable builtin TS extension globally in favor of takeover mode.
Feature Request
By default vscode agressively sorts everything by label, so initial order of suggestions is lost.
I’m just asking you to add a volar.extended.forceSortSuggestions
setting. Here https://github.com/johnsoncodehk/volar/blob/master/packages/server/src/features/languageFeatures.ts#L45 add
if (list) list.items.forEach((item, i) => {
item.sortText = `${item.sortText ?? ''}${i}`
})
Here is a code you can test with:
interface Foo {
b: string,
}
interface Bar {
c: boolean,
}
interface Test extends Foo, Bar {
a: number
}
const d: Test = {
// trigger suggestions here
};
The setting will be disabled by default, so we don’t break anything for existing users.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
I finally have had time to dig into it. If you’re curious why you had it: https://github.com/microsoft/TypeScript/issues/49012 (spoiler: we’ve had different versions of the TS Server somehow)
Sorry for late reply. @johnsoncodehk, just if you’re curious, I tried a simple TS plugin that solves the issue. It works well in all cases from above
Sorry I didn’t really have time to figure out why it doesn’t work with the latest versions of Volar. It does work with builtin TS support (4.6.3) and I hope there will be a way to use this simple plugin in Volar.
Again, I found it incredibly useful, so I think I will even publish this as extension. Will Volar read and use
typescriptServerPlugins
from ext?