You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If a component has an uninitialized export (and is not typed as undefined) then all error reporting breaks. It appears from the log (attached before) that svelte-language-server throws in this case. I have tried to track the bug down, but I am not familiar enough with the code base yet.
To Reproduce
Steps to reproduce the behavior:
Open the below code snippet.
Note let name: number = ''; is not flagged
Change export let test: string; -> export let test: string | undefined or export let test = "test";
let name: number = ''; is now flagged
Test.svelte
<scriptlang="ts">exportlet test:string; let name:number='';
</script>
<div>{test}</div>
Expected behavior
I except the type checking to continue and for other errors/warnings to be emitted.
Maybe a Variable 'test' is used before being assigned error is appropriate too, although, with the context of Svelte these are required props (?).
Screenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
I believe this is a the relevant error from the CoC log:
[["nvim_call_function",["setbufline",["output:///svelte","$","Error: Range#create called with invalid arguments[[object Object], [object Object], undefined, undefined]"]]],["nvim_call_function",["appendbufline",["output:///svelte","$",[" at Object.create (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types/lib/umd/main.js:71:23)"," at mapRangeToOriginal (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/lib/documents/DocumentMapper.js:141:42)"," at Object.mapObjWithRangeToOriginal (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/lib/documents/DocumentMapper.js:163:38)"," at /home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/plugins/typescript/features/DiagnosticsProvider.js:45:46"," at Array.map (<anonymous>)"," at DiagnosticsProviderImpl.getDiagnostics (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/plugins/typescript/features/DiagnosticsProvider.js:45:14)"," at async PluginHost.tryExecutePlugin (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/plugins/PluginHost.js:228:20)"," at async Promise.all (index 2)"," at async PluginHost.getDiagnostics (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/plugins/PluginHost.js:34:33)"," at async DiagnosticsManager.update (/home/abalmos/.config/coc/extensions/node_modules/coc-svelte/node_modules/svelte-language-server/dist/src/lib/DiagnosticsManager.js:16:29)",""]]]]]
The text was updated successfully, but these errors were encountered:
Seems like this is an old version of svelte-language-server. We no longer use that Object.create function in the trace. Can you check what version you're using?
@jasonlyu123 Your right. I was using coc-svelte which is quite out of date. Tested using vscode and and the svelte plugin and everything works as expected.
Describe the bug
If a component has an uninitialized export (and is not typed as
undefined
) then all error reporting breaks. It appears from the log (attached before) thatsvelte-language-server
throws in this case. I have tried to track the bug down, but I am not familiar enough with the code base yet.To Reproduce
Steps to reproduce the behavior:
let name: number = '';
is not flaggedexport let test: string;
->export let test: string | undefined
orexport let test = "test";
let name: number = '';
is now flaggedTest.svelte
Expected behavior
I except the type checking to continue and for other errors/warnings to be emitted.
Maybe a
Variable 'test' is used before being assigned
error is appropriate too, although, with the context of Svelte these are required props (?).Screenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
svelte-language-server
)Additional context
I believe this is a the relevant error from the CoC log:
The text was updated successfully, but these errors were encountered: