In short, create a new flutter project , flutter create test, create .projectile in the new project root, open test/lib/main.dart . LSP prompts to import , hit "i". LSP and flycheck appear to be enabled but it doesn't work... No flycheck errors when you force an error, no LSP UI annotations.
If you set the project root as test/lib then it works BUT isn't really functional, as any packages added eg
flutter pub add flame
eg
import 'package:flame/game.dart';
fails.
If I set the root to the proper root (no lsp ui annotations or flycheck errors) completion of newly added libraries DOES work - indicating LSP is working from the root - so something weird.
Workaround : If I delete session.el I can set the import directory for to ROOT/lib when I start lsp, then I can add the ROOT directory as a workspace folder and then things seem to work so far BUT only after an emacs restart. Adding the flutter project root as a workspace doesnt make it work during the current session even if I disconnect lsp and restart. I need to restart emacs. Sounds dodgy I know, but its what I'm seeing.
As an addendum: eglot just works without prompting or needing to add additional workspaces indicating the error might be at the lsp package level rather than the dart analysis server. I'd prefer to use lsp because of its richer UI experience.
Emacs 29 built from source. Using straight package manager.
I documented the issue here : https://www.reddit.com/r/emacs/comments/156udd9/lsp_package_and_dartflutter_issues/?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_term=1&utm_content=1
In short, create a new flutter project ,
flutter create test
, create.projectile
in the new project root, open test/lib/main.dart . LSP prompts to import , hit "i". LSP and flycheck appear to be enabled but it doesn't work... No flycheck errors when you force an error, no LSP UI annotations.If you set the project root as test/lib then it works BUT isn't really functional, as any packages added eg
flutter pub add flame
eg
import 'package:flame/game.dart';
fails.
If I set the root to the proper root (no lsp ui annotations or flycheck errors) completion of newly added libraries DOES work - indicating LSP is working from the root - so something weird.
Workaround : If I delete session.el I can set the import directory for to ROOT/lib when I start lsp, then I can add the ROOT directory as a workspace folder and then things seem to work so far BUT only after an emacs restart. Adding the flutter project root as a workspace doesnt make it work during the current session even if I disconnect lsp and restart. I need to restart emacs. Sounds dodgy I know, but its what I'm seeing.
As an addendum: eglot just works without prompting or needing to add additional workspaces indicating the error might be at the lsp package level rather than the dart analysis server. I'd prefer to use lsp because of its richer UI experience.
Pretty standard lsp setup.
https://github.com/rileyrg/Emacs-Customisations/blob/dev/etc/elisp/rgr-lsp.el