Diagnostic message "Stores must be declared at the top level of the component" gives invalid line number
See original GitHub issueDescribe the bug
The diagnostic message Stores must be declared at the top level of the component
comes with a line number of -1, which is invalid: https://microsoft.github.io/language-server-protocol/specification#position This breaks diagnostics in my editor.
To Reproduce Here is a minimal file that repros this for me:
<script lang="ts">
import { writable } from "svelte/store";
let foo = writable("value");
function bar() {
let bar = foo;
console.log($bar);
}
</script>
Expected behavior The line number should ideally be the line number of the underlying problem, but at the very least (if this is an upstream svelte problem) it should be validated to be non-negative, eg setting it to 0.
Screenshots If applicable, add screenshots to help explain your problem.
System (please complete the following information):
- OS: Mac OS 12.0
- IDE: Neovim
- Plugin/Package: svelte-language-server 0.14.13
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Diagnostic messages - Dart
This page lists diagnostic messages produced by the Dart analyzer, with details about what those messages mean and how you can fix your...
Read more >Common error messages in SAS | SAS Learning Modules
The first NOTE says that the data for variable "a" is invalid in line 2311 position 1-4. Since line 2310 is the line...
Read more >Settings Reference for Python - Visual Studio Code
Diagnostics for imports that have no corresponding source file. This happens when a type stub is found, but the module source file was...
Read more >Debugging code - Roku Developer
Debugger message: "'Dot' Operator attempted with invalid BrightScript Component or interface reference". This message will often coincide with a blank screen.
Read more >Documentation: 15: 43.6. Control Structures - PostgreSQL
But to return a composite (row) value, you must write an expression delivering ... If control reaches the end of the top-level block...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s fixed in https://github.com/sveltejs/svelte-preprocess/pull/407
Yeah we also should fix the line number.
Does a version bump help us, or is this something that’s still a problem inside
svelte-preprocess
? Or is it just a configuration problem on our end? Maybe we need to passsourceMap: true
as well?