question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LSP crashes while editing one specific file on my Flutter project.

See original GitHub issue

Describe the bug After updating to null-safe Flutter, a file named decorations.dart on my file hiearchy shows errors, crashes LSP and does not respond to modifications to the file (errors are still indicated even after modifying/fixing them.). LSP keeps producing error messages after every keystroke and mouse movement.

To Reproduce Steps to reproduce the behavior:

  1. Generate a file named decorations.dart. (On my project, file path is as following: lib/values/decorations.dart)
  2. Write some code which violates null-safety.
  3. Try to modify file.

Expected behavior I expect the editor and LSP to behave same way as when I modify any other file.

Flutter Doctor Log

[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.18363.1441], locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 3.5)
[√] IntelliJ IDEA Community Edition (version 2018.3)
[√] VS Code, 64-bit edition (version 1.54.2)
[√] Connected device (2 available)

Note I get a seperate report from LSP for every action performed while modifying the file; here is a few examples:

[Error - 21:22:13] Request textDocument/hover failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:22:13] Request textDocument/codeAction failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:22:14] Request textDocument/documentHighlight failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:22:14] Request textDocument/codeAction failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:22:14] Request textDocument/hover failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:32:58] Request textDocument/hover failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:32:59] Request textDocument/hover failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:32:59] Request textDocument/hover failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart
[Error - 21:32:59] Request textDocument/codeAction failed.
  Message: Invalid file path
  Code: -32003 
...\lib\values\decorations.dart

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Mar 29, 2021

I was able to reduce this to a small amount of code in https://github.com/dart-lang/sdk/issues/45504. I think it might be related to having both private and public variables in the same definition:

const kOne = 1, _kTwo = 2;

Renaming _kTwo to just kTwo or putting it in its own declaration seemed to prevent the issue, so that might be a reasonable workaround for you for now until the issue is fixed.

I’ll close this issue as once it’s fixed in the SDK (and you have an updated SDK) there will be nothing to do in the VS Code extension. Thanks!

1reaction
DanTupcommented, Mar 29, 2021

Thanks! I can reproduce this - it’s definitely failing to parse something in that code. I’ll try narrow it down and file an SDK issue with a small repro. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dart/ flutter: application crashes on startup - Stack Overflow
To check which library is causing the crash, look at the logs using Logcat by going to View > Tool Windows > Logcat...
Read more >
New experimental Razor editor for Visual Studio - .NET Blog
You're now setup to use the new Razor editor when working with Razor files locally (.cshtml and .razor). What is Razor? Razor is...
Read more >
Language Server Extension Guide - Visual Studio Code
Language Server is a special kind of Visual Studio Code extension that powers the editing experience for many programming languages. With Language Servers ......
Read more >
Helix: A Neovim inspired editor, written in Rust | Hacker News
I've used Helix for all my recreational programming projects (in Rust) for about 6 months and I've written about 10kLOC of code with...
Read more >
Documentation - Doom Emacs v21.12 documentation
TODO Projects; 5.6. TODO Programming. 5.6.1. LSP and servers; 5.6.2. Jump to definition/references; 5.6.3. Compiling; 5.6.4. Executing code on-the-fly ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found