coc-extensions / coc-svelte

svelte support for (Neo)Vim
MIT License
178 stars 24 forks source link

Handle document changes in .js and .ts files #47

Closed dimfeld closed 2 years ago

dimfeld commented 2 years ago

The Svelte VSCode extension monitors changes to JS/TS files so that it can manually notify the Svelte language server of those changes. This makes Svelte Typescript support update in real-time for changes in non-Svelte files.

This PR is a copy from the VSCode extension, with a minor change to check the filename instead of using the document.languageId field which coc.nvim doesn't provide.

The bulk of the original code is here for comparison: https://github.com/sveltejs/language-tools/blob/a0b01ff7a58e6bedf0bb087b0023d3b6ea7cd0eb/packages/svelte-vscode/src/extension.ts#L275

dimfeld commented 2 years ago

Updated with requested changes. Thanks!