ts-type-explorer icon indicating copy to clipboard operation
ts-type-explorer copied to clipboard

Incompatible with Svelte Plugin

Open mxsdev opened this issue 3 years ago • 2 comments

Since the plugin now overrides completions, plugins which interface with completions, such as the svelte plugin, are incompatible, and can cause errors retrieving info.

There's probably a few ways to approach solving this, like returning dummy info, or forcing extension load order somehow (by e.g. requiring the svelte extension as a dependency, if VSCode provides a way to do that).

mxsdev avatar Oct 29 '22 06:10 mxsdev

Hi! I was interested in this. Overriding LS methods with proxy shouldn't never break other plugins as long as you follow its interfaces. Also I was always convinced that there is no way to load extensions in other order (and no need for it).

But I noticed it wasn't working with my plugin: https://github.com/zardoy/typescript-vscode-plugins. It was happening because you're not following getCompletionsAtPosition options interface. triggerCharacter should always be string, why don't you use JSON.parse? Btw I was also using triggerCharacter as its only a way to get arbitrary data from TS LS and even have exposed api for it in extensionHost example. And also configurePlugin doesn't seem to work in web, so I was using it pass config. However do you know a way to communicate with the same way with syntax TS server?

Btw I pushed a fix for your plugin on my end:

if (options?.triggerCharacter && typeof options?.triggerCharacter !== 'string') {
    return languageService.getCompletionsAtPosition(fileName, position, options)
}

zardoy avatar Feb 18 '23 22:02 zardoy

Also as I noticed it doesn't work in untitled, use this file to ts requests: https://github.com/orta/vscode-twoslash-queries/blob/fc91d1c8baf0622ba85e64d3cf43efb06e5d23d7/src/extension.ts#L34

zardoy avatar Feb 18 '23 22:02 zardoy