emacs-lsp / lsp-dart

lsp-mode :heart: dart
https://emacs-lsp.github.io/lsp-dart
GNU General Public License v3.0
202 stars 24 forks source link

Very slow when create a new refresh dart file in flutter project and typing code myself if enable `lsp-dart-show-flutter-outline`. #127

Closed zw963 closed 2 years ago

zw963 commented 2 years ago

Describe the bug

I create a new file like this:

image

When i start o editing this file, key strikeis very very slow, after pressing key and before char show on buffer, need wait several seconds, following is profiler result.

image

But, if editing on a exists file, it is Okay.

Sorry for i don't know how to disable native compile for this case.

ericdallo commented 2 years ago

Hum, that's weird, I use native-comp and can't repro this. any thoughts @yyoncho ?

zw963 commented 2 years ago

Hum, that's weird, I use native-comp and can't repro this. any thoughts @yyoncho ?

Hi, i can always reproduce this. followiing is a guide:

  1. start emacs with minimum config
  2. open a more bigger flutter file, wait lsp start correctly.
  3. run lsp-dart-show-flutter-outline, until it appear successful.
  4. open another small flutter file. (it can be empty)
  5. start editing, very very slow.
ericdallo commented 2 years ago

thanks, I'll follow that and try to understand what is happening

zw963 commented 2 years ago

Following is a new bug output with very few packages.

Debugger entered--Lisp error: (error "Timeout while waiting for response. Method: textD...") error("Timeout while waiting for response. Method: %s" "textDocument/codeAction") lsp-request("textDocument/codeAction" (:textDocument (:uri "file:///home/zw963/Magpie/magpie-mobile-app/lib/pa...") :range (:start (:line 33 :character 11) :end (:line 33 :character 11)) :context (:diagnostics []))) lsp-code-actions-at-point() lsp-dart-outline--build-flutter-outline-widget-actions("file:///home/zw963/Magpie/magpie-mobile-app/lib/pa..." #<hash-table equal 2/2 0x158eb3268ab1>)

f(compiled-function (input0) #<bytecode -0x85f870dc4e0560e>)(#<hash-table equal 6/6 0x158eb32686e9>)

mapcar(#f(compiled-function (input0) #<bytecode -0x85f870dc4e0560e>) [#<hash-table equal 6/6 0x158eb32686e9>])

f(compiled-function #'sequence #<bytecode 0x184324a4d1a0c334>)(#f(compiled-function (input0) #<bytecode -0x85f870dc4e0560e>) [#<hash-table equal 6/6 0x158eb32686e9>])

apply(#f(compiled-function #'sequence #<bytecode 0x184324a4d1a0c334>) #f(compiled-function (input0) #<bytecode -0x85f870dc4e0560e>) [#<hash-table equal 6/6 0x158eb32686e9>] nil) seq-map(#f(compiled-function (input0) #<bytecode -0x85f870dc4e0560e>) [#<hash-table equal 6/6 0x158eb32686e9>]) lsp-dart-outline--flutter-outline->tree("file:///home/zw963/Magpie/magpie-mobile-app/lib/pa..." [#<hash-table equal 6/6 0x158eb32686e9>])

f(compiled-function (&rest _) #<bytecode 0x14e4397134f2a973>)((:key #("_buildQuery ()" 11 14 (face lsp-lens-face)) :label #("buildQuery ()" 11 14 (face lsp-lens-face)) :icon method :children #f(compiled-function (&rest ) #<bytecode 0x14e4397134f2a973>) :ret-action #f(compiled-function (&rest _) #<bytecode 0xbf37a45d217e6c0>) :actions nil :uri "file:///home/zw963/Magpie/magpie-mobile-app/lib/pa..."))

treemacs--do-expand-node(#<marker (moves after insertion) at 726 in Flutter Outline>) treemacs-expand-node()

f(compiled-function (btn) #<bytecode -0x140b6afad1a7e18c>)(#<marker (moves after insertion) at 726 in Flutter Outline>)

-map(#f(compiled-function (btn) #<bytecode -0x140b6afad1a7e18c>) (#<marker (moves after insertion) at 726 in Flutter Outline> #<marker (moves after insertion) at 726 in Flutter Outline> #<marker (moves after insertion) at 726 in Flutter Outline> #<marker (moves after insertion) at 726 in Flutter Outline>)) lsp-treemacs--expand-recursively(#<marker (moves after insertion) at 726 in Flutter Outline> t)

f(compiled-function (btn) #<bytecode -0x140b6afad1a7e18c>)(#<marker (moves after insertion) at 726 in Flutter Outline>)

-map(#f(compiled-function (btn) #<bytecode -0x140b6afad1a7e18c>) (#<marker (moves after insertion) at 726 in Flutter Outline> #<marker (moves after insertion) at 726 in Flutter Outline> #<marker (moves after insertion) at 726 in Flutter Outline>)) lsp-treemacs--expand-recursively(#<marker at 1 in Flutter Outline> t) lsp-treemacs--expand(LSP-Generic t) lsp-treemacs-render(((:key "MyTransactionsPage" :label "MyTransactionsPage" :icon class :children #f(compiled-function (&rest ) #<bytecode -0x4862bab1ed82693>) :ret-action #f(compiled-function (&rest ) #<bytecode 0xbf37a45dc8b60c0>) :actions nil :uri "file:///home/zw963/Magpie/magpie-mobile-app/lib/pa...") (:key "_State" :label "State" :icon class :children #f(compiled-function (&rest ) #<bytecode 0x16fa2096de5fc9b2>) :ret-action #f(compiled-function (&rest _) #<bytecode 0xbf37a45de155cc0>) :actions nil :uri "file:///home/zw963/Magpie/magpie-mobile-app/lib/pa...") (:key "_Item" :label "Item" :icon class :children #f(compiled-function (&rest ) #<bytecode -0x411eeb8c6338643>) :ret-action #f(compiled-function (&rest _) #<bytecode 0xbf37a45d854c6c0>) :actions nil :uri "file:///home/zw963/Magpie/magpie-mobile-app/lib/pa...")) "Flutter Outline" t "Flutter Outline") lsp-dart-outline--render-flutter-outline-tree("file:///home/zw963/Magpie/magpie-mobile-app/lib/pa..." [#<hash-table equal 5/5 0x158eb32659f1> #<hash-table equal 5/5 0x158eb3266b57> #<hash-table equal 5/5 0x158eb326d78f>]) lsp-dart-outline--show-flutter-outline(t) lsp-dart--flutter-outline-check(#<hash-table equal 2/2 0x158eb325649f>) run-hook-with-args(lsp-dart--flutter-outline-check #<hash-table equal 2/2 0x158eb325649f>)

f(compiled-function (workspace notification) #<bytecode 0xaadfe219a0e51a5>)(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 15/15 0x158eaf73c81d> :registered-server-capabilities (#s(lsp--registered-capability :id "5" :method "textDocument/semanticTokens" :options #<hash-table equal 4/4 0x158eb24e34cf>) #s(lsp--registered-capability :id "4" :method "textDocument/foldingRange" :options #<hash-table equal 1/1 0x158eb24e3415>) #s(lsp--registered-capability :id "3" :method "textDocument/rename" :options #<hash-table equal 2/2 0x158eb24e30e5>) #s(lsp--registered-capability :id "2" :method "textDocument/codeAction" :options #<hash-table equal 2/2 0x158eb24e2fe5>) #s(lsp--registered-capability :id "1" :method "textDocument/rangeFormatting" :options #<hash-table equal 1/1 0x158eb24e2f1b>) #s(lsp--registered-capability :id "0" :method "textDocument/formatting" :options #<hash-table equal 1/1 0x158eb24e2e51>)) :root "/home/zw963/Magpie/magpie-mobile-app" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode -0xc3193771be701df>) :test\? #f(compiled-function () #<bytecode 0x1f70c1a645af>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 4/65 0x158eb10f5c53> :request-handlers #<hash-table equal 0/65 0x158eb10f627d> :response-handlers #<hash-table eql 0/65 0x158eb10f64ab> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x158eb10f684f> :action-handlers #<hash-table equal 0/65 0x158eb10f68f3> :major-modes nil :activation-fn #f(compiled-function (filename &optional _) #<bytecode -0xe0669dd8e14eddd>) :priority 1 :server-id dart_analysis_server :multi-root nil :initialization-options ((onlyAnalyzeProjectsWithOpenFiles) (suggestFromUnimportedLibraries . t) (closingLabels . t) (outline . t) (flutterOutline . t)) :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode -0x47e8176751a36b8>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn lsp-dart--activate-features :async-request-handlers #<hash-table equal 0/65 0x158eb10f6d45> :download-server-fn nil :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc # :cmd-proc # :buffers (# #) :semantic-tokens-faces [nil lsp-face-semhl-keyword lsp-face-semhl-class lsp-face-semhl-comment lsp-face-semhl-method lsp-face-semhl-variable lsp-face-semhl-parameter lsp-face-semhl-enum lsp-face-semhl-constant lsp-face-semhl-type nil lsp-face-semhl-property lsp-face-semhl-namespace nil lsp-face-semhl-number lsp-face-semhl-string lsp-face-semhl-function lsp-face-semhl-type-parameter] :semantic-tokens-modifier-faces [lsp-face-semhl-comment nil lsp-face-semhl-interface nil lsp-face-semhl-static nil nil nil nil nil nil] :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x158eb23731df> :watches #<hash-table equal 0/65 0x158eb23731ff> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0x158eb237457d> :work-done-tokens #<hash-table equal 1/65 0x158eb23749dd>) #<hash-table equal 2/2 0x158eb325649f>)

lsp--on-notification(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 15/15 0x158eaf73c81d> :registered-server-capabilities (#s(lsp--registered-capability :id "5" :method "textDocument/semanticTokens" :options #<hash-table equal 4/4 0x158eb24e34cf>) #s(lsp--registered-capability :id "4" :method "textDocument/foldingRange" :options #<hash-table equal 1/1 0x158eb24e3415>) #s(lsp--registered-capability :id "3" :method "textDocument/rename" :options #<hash-table equal 2/2 0x158eb24e30e5>) #s(lsp--registered-capability :id "2" :method "textDocument/codeAction" :options #<hash-table equal 2/2 0x158eb24e2fe5>) #s(lsp--registered-capability :id "1" :method "textDocument/rangeFormatting" :options #<hash-table equal 1/1 0x158eb24e2f1b>) #s(lsp--registered-capability :id "0" :method "textDocument/formatting" :options #<hash-table equal 1/1 0x158eb24e2e51>)) :root "/home/zw963/Magpie/magpie-mobile-app" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode -0xc3193771be701df>) :test\? #f(compiled-function () #<bytecode 0x1f70c1a645af>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 4/65 0x158eb10f5c53> :request-handlers #<hash-table equal 0/65 0x158eb10f627d> :response-handlers #<hash-table eql 0/65 0x158eb10f64ab> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x158eb10f684f> :action-handlers #<hash-table equal 0/65 0x158eb10f68f3> :major-modes nil :activation-fn #f(compiled-function (filename &optional _) #<bytecode -0xe0669dd8e14eddd>) :priority 1 :server-id dart_analysis_server :multi-root nil :initialization-options ((onlyAnalyzeProjectsWithOpenFiles) (suggestFromUnimportedLibraries . t) (closingLabels . t) (outline . t) (flutterOutline . t)) :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode -0x47e8176751a36b8>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn lsp-dart--activate-features :async-request-handlers #<hash-table equal 0/65 0x158eb10f6d45> :download-server-fn nil :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc # :cmd-proc # :buffers (# #) :semantic-tokens-faces [nil lsp-face-semhl-keyword lsp-face-semhl-class lsp-face-semhl-comment lsp-face-semhl-method lsp-face-semhl-variable lsp-face-semhl-parameter lsp-face-semhl-enum lsp-face-semhl-constant lsp-face-semhl-type nil lsp-face-semhl-property lsp-face-semhl-namespace nil lsp-face-semhl-number lsp-face-semhl-string lsp-face-semhl-function lsp-face-semhl-type-parameter] :semantic-tokens-modifier-faces [lsp-face-semhl-comment nil lsp-face-semhl-interface nil lsp-face-semhl-static nil nil nil nil nil nil] :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x158eb23731df> :watches #<hash-table equal 0/65 0x158eb23731ff> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0x158eb237457d> :work-done-tokens #<hash-table equal 1/65 0x158eb23749dd>) #<hash-table equal 3/3 0x158eb3256449>) lsp--parser-on-message(#<hash-table equal 3/3 0x158eb3256449> #s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 15/15 0x158eaf73c81d> :registered-server-capabilities (#s(lsp--registered-capability :id "5" :method "textDocument/semanticTokens" :options #<hash-table equal 4/4 0x158eb24e34cf>) #s(lsp--registered-capability :id "4" :method "textDocument/foldingRange" :options #<hash-table equal 1/1 0x158eb24e3415>) #s(lsp--registered-capability :id "3" :method "textDocument/rename" :options #<hash-table equal 2/2 0x158eb24e30e5>) #s(lsp--registered-capability :id "2" :method "textDocument/codeAction" :options #<hash-table equal 2/2 0x158eb24e2fe5>) #s(lsp--registered-capability :id "1" :method "textDocument/rangeFormatting" :options #<hash-table equal 1/1 0x158eb24e2f1b>) #s(lsp--registered-capability :id "0" :method "textDocument/formatting" :options #<hash-table equal 1/1 0x158eb24e2e51>)) :root "/home/zw963/Magpie/magpie-mobile-app" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode -0xc3193771be701df>) :test\? #f(compiled-function () #<bytecode 0x1f70c1a645af>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 4/65 0x158eb10f5c53> :request-handlers #<hash-table equal 0/65 0x158eb10f627d> :response-handlers #<hash-table eql 0/65 0x158eb10f64ab> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x158eb10f684f> :action-handlers #<hash-table equal 0/65 0x158eb10f68f3> :major-modes nil :activation-fn #f(compiled-function (filename &optional _) #<bytecode -0xe0669dd8e14eddd>) :priority 1 :server-id dart_analysis_server :multi-root nil :initialization-options ((onlyAnalyzeProjectsWithOpenFiles) (suggestFromUnimportedLibraries . t) (closingLabels . t) (outline . t) (flutterOutline . t)) :semantic-tokens-faces-overrides nil :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode -0x47e8176751a36b8>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn lsp-dart--activate-features :async-request-handlers #<hash-table equal 0/65 0x158eb10f6d45> :download-server-fn nil :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc # :cmd-proc # :buffers (# #) :semantic-tokens-faces [nil lsp-face-semhl-keyword lsp-face-semhl-class lsp-face-semhl-comment lsp-face-semhl-method lsp-face-semhl-variable lsp-face-semhl-parameter lsp-face-semhl-enum lsp-face-semhl-constant lsp-face-semhl-type nil lsp-face-semhl-property lsp-face-semhl-namespace nil lsp-face-semhl-number lsp-face-semhl-string lsp-face-semhl-function lsp-face-semhl-type-parameter] :semantic-tokens-modifier-faces [lsp-face-semhl-comment nil lsp-face-semhl-interface nil lsp-face-semhl-static nil nil nil nil nil nil] :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x158eb23731df> :watches #<hash-table equal 0/65 0x158eb23731ff> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0x158eb237457d> :work-done-tokens #<hash-table equal 1/65 0x158eb23749dd>))

f(compiled-function (msg) #<bytecode -0x1f25b4e7277624e3>)(#<hash-table equal 3/3 0x158eb3256449>)

mapc(#f(compiled-function (msg) #<bytecode -0x1f25b4e7277624e3>) (#<hash-table equal 3/3 0x158eb3256449> #<hash-table equal 3/3 0x158eb32629cd> #<hash-table equal 3/3 0x158eb3262b6f> #<hash-table equal 3/3 0x158eb3262c3d> #<hash-table equal 3/3 0x158eb3264c95>))

f(compiled-function (proc input) #<bytecode 0x5dfc1507ef27dda>)(# "\":{\"line\":114,\"character\":2},\"end\":{\"line\":121,\"ch...")

ericdallo commented 2 years ago

it could be a server bug as well, what flutter/dart version are you using?

zw963 commented 2 years ago

it could be a server bug as well, what flutter/dart version are you using?

Are you reproduce success?

i tested just now, i can reproduce with only following config:

(require 'dart-mode)
(require 'lsp-mode)
(require 'lsp-dart)
(require 'lsp-ui)
(require 'lsp-modeline)
(require 'lsp-headerline)
(require 'lsp-treemacs)
(require 'dap-mode)
(require 'dap-ui)
(require 'dap-mouse)
(require 'flycheck)
(require 'company)

(add-hook 'dart-mode-hook 'lsp)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
 ╰─ $ 130  flutter --version
Flutter 2.8.1 • channel unknown • unknown source
Framework • revision 77d935af4d (2 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
ericdallo commented 2 years ago

Yes, it feels very smooth to me, no issues ATM 🤔 ls-dart-issue-127

ericdallo commented 2 years ago

Let me try testing with your flutter version

zw963 commented 2 years ago

Sorry, maybe i describe not so accurately.

in fact, when i start lsp-dart-show-flutter-outline, edit on current file is starting lag too.

you can add somethings, and then delete it use backspace.

ericdallo commented 2 years ago

Even so, nothing lagging to me, will test with your flutter, one sec

zw963 commented 2 years ago

image

ericdallo commented 2 years ago

so it could be a performance issue on flutter widget-guide, could you try disabling it? I know it's a feature that can be slow on huge buffers (setq lsp-dart-flutter-widget-guides nil)

ericdallo commented 2 years ago

@zw963 tested with your same flutter version and no signs of slowness on both features, I'm using Emacs 28 from master though, but I doubt it's related

ericdallo commented 2 years ago

what is your output of lsp-doctor?

zw963 commented 2 years ago

(setq lsp-dart-flutter-widget-guides nil)

done, still same.

BTW: i am now test on a new created flutter project ... only one file, main.dart, and this issue never happen if not enable flutter-outline.

what is your output of lsp-doctor?

Checking for Native JSON support: OK
Check emacs supports `read-process-output-max': OK
Check `read-process-output-max' default has been changed from 4k: ERROR
Byte compiled against Native JSON (recompile lsp-mode if failing when Native JSON available): OK
`gc-cons-threshold' increased?: OK
Using `plist' for deserialized objects?: OPTIONAL
Using gccemacs with emacs lisp native compilation (https://akrl.sdf.org/gccemacs.html): OK
ericdallo commented 2 years ago

I usually use https://github.com/ericdallo/flutter_sample for testing lsp-dart stuff

ericdallo commented 2 years ago

This one could affect this issue:

Check `read-process-output-max' default has been changed from 4k: OK

Mine is here: https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L36

zw963 commented 2 years ago

I usually use https://github.com/ericdallo/flutter_sample for testing lsp-dart stuff

It so wired it not slow when i pull your's flutter sample, and edit on it.

but, i a run flutter create new_project, and then open it, it very lag. could you please try it use new flutter 2.8.1 create a new project then do same?

zw963 commented 2 years ago

or, you can try on this i created just now.

test_flutter_performance.zip

ericdallo commented 2 years ago

Sure, will test it

zw963 commented 2 years ago

This one could affect this issue:

Check `read-process-output-max' default has been changed from 4k: OK

Mine is here: https://github.com/ericdallo/dotfiles/blob/master/.doom.d/config.el#L36

I test use this config, a little better, but, still much slow than not enable flutter guides

ericdallo commented 2 years ago

Everything looks pretty fast to me with your zip project 😔

lsp-dart-issue-127-2

Note: the gif is using 24fps not 30

ericdallo commented 2 years ago

No clue, sounds like some missing emacs optimization

zw963 commented 2 years ago

No clue, sounds like some missing emacs optimization

are you install emacs use compile? could you please share your's configure config?

zw963 commented 2 years ago

Note: the gif is using 24fps not 30

Your's emacs IDE is so so so fast!

ericdallo commented 2 years ago

Sure, I use doom-emacs and all my OS config including emacs config is here

Your's emacs IDE is so so so fast!

doom-emacs is fast! it byte compiles all packages and native byte-compiles if using native-comp emacs, you can follow this to setup it: https://github.com/hlissner/doom-emacs#install

zw963 commented 2 years ago

Sure, I use doom-emacs and all my OS config including emacs config is here

What i means is, your's emacs editor is compile from source code, right? could you please share your's configure ?

ericdallo commented 2 years ago

What i means is, your's emacs editor is compile from source code, right? could you please share your's configure ?

Oh, I use NixOS and use the emacs from here as my config specifies here. It basically download emacs master branch and compiles it, I don't know the specific details emacsGcc overlay does though

zw963 commented 2 years ago

I am compile emacs 28 use newest emacs-28 branch.

If you said this is emacs optimization issue, i guess maybe cause by gcmh or auto-compile, those are only two package when i test new minimum config, i will test it after compile done, let you know the result.

zw963 commented 2 years ago

What i means is, your's emacs editor is compile from source code, right? could you please share your's configure ?

Oh, I use NixOS and use the emacs from here as my config specifies here. It basically download emacs master branch and compiles it, I don't know the specific details emacsGcc overlay does though

Cool linux, i am a arch linux user, some guy migrate from arch to NixOS ...

zw963 commented 2 years ago

I am compile emacs 28 use newest emacs-28 branch.

If you said this is emacs optimization issue, i guess maybe cause by gcmh or auto-compile, those are only two package when i test new minimum config, i will test it after compile done, let you know the result.

same issue after recompile + disable GCMH mode, i will recompile again without --with-xwidget option, perhaps this option cause this.

is there any other emacs optimization suit for lsp-dart?

ericdallo commented 2 years ago

I don't think so, never saw this kind of performance issue besides configs 🤔

zw963 commented 2 years ago

I don't think so, never saw this kind of performance issue besides configs thinking

definitely not config issue, because i remove all my config, except set load path, only left following line config in my $HOME/.emacs, the only entry.

(require 'dart-mode)
(require 'lsp-mode)
(require 'lsp-dart)
(require 'lsp-ui)
(require 'lsp-modeline)
(require 'lsp-headerline)
(require 'lsp-treemacs)
(require 'dap-mode)
(require 'dap-ui)
(require 'dap-mouse)
(require 'flycheck)
(require 'company)

(setq lsp-dart-flutter-widget-guides nil)
(add-hook 'dart-mode-hook 'lsp)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
zw963 commented 2 years ago

image

Okay, maybe my laptop performance was too bad, is there a way to disable this feature after enable it?

ericdallo commented 2 years ago

yes, (setq lsp-dart-outline nil) and (setq lsp-dart-flutter-outline nil) should disable it

zw963 commented 2 years ago

yes, (setq lsp-dart-outline nil) and (setq lsp-dart-flutter-outline nil) should disable it

Not work, can we add a command to disable it if enable it unexpectedly occasionally.

BTW, if i run lsp-treemacs-symbols to replace the window for lsp-dart-show-flutter-outline, even, i never set above two variable, but, speed is normal now.

i don't know why, after bring flutter outline back foreground, it start lag again.

zw963 commented 2 years ago

Everything looks pretty fast to me with your zip project pensive

lsp-dart-issue-127-2

Note: the gif is using 24fps not 30

Hi, @ericdallo , i found the different!

you test code use lsp-dart-show-outline, but i test code use lsp-dart-show-flutter-outline,

if i use former command, never slow too.

I don't know the different about both command, but, it seem like flutter on have icons.

image

dart one no icon.

image

I guess those icon cause this issue? can we test on both command, but not enable icon?

ericdallo commented 2 years ago

I doubt it's the icon, but it worth the test

zw963 commented 2 years ago

I doubt it's the icon, but it worth the test

When use with lsp-dart-show-flutter-outline, there add right click menu too, anyway, we need debug both of them.

ericdallo commented 2 years ago

Good news @zw963 for me the flutter outline is slow as well!, there is certainly something to improve on lsp-dart :)

ericdallo commented 2 years ago

@zw963 fixed on master, keep in mind it requires latest lsp-treemacs as well, thank you for the report! we were requesting code actions for each flutter item on the outline eagerly, now we only request if user right click, lazily :)

zw963 commented 2 years ago

@ericdallo , i try several times, both of them start lsp failed.

LSP :: Connected to [dart_analysis_server:136315/starting].
Error processing message (wrong-type-argument hash-table-p (:id 1 :jsonrpc "2.0" :result (:capabilities (:textDocumentSync (:openClose t :change 2 :willSave nil :willSaveWaitUntil nil) :completionProvider (:triggerCharacters ["." "=" "(" "$" "\"" "'" "{" "/" ":"] :resolveProvider t) :hoverProvider t :signatureHelpProvider (:triggerCharacters ["("] :retriggerCharacters [","]) :definitionProvider t :implementationProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :documentRangeFormattingProvider t :documentOnTypeFormattingProvider (:firstTriggerCharacter "}" :moreTriggerCharacter [";"]) :executeCommandProvider (:commands ["edit.sortMembers" "edit.organizeImports" "edit.fixAll" "edit.sendWorkspaceEdit" "refactor.perform"] :workDoneProgress t) :selectionRangeProvider t :workspaceSymbolProvider t :workspace (:workspaceFolders (:supported t :changeNotifications t) :fileOperations (:willRename (:filters [(:scheme "file" :pattern (:glob "**/*.dart" :matches "file"))])))) :serverInfo (:name "Dart SDK LSP Analysis Server" :version "2.15.1")))).
Mark set
ericdallo commented 2 years ago

@zw963 that error doesn't seem related, probably some bad compiled package... make sure lsp-dart and lsp-treemacs are latest from melpa unstable

zw963 commented 2 years ago

@zw963 that error doesn't seem related, probably some bad compiled package... make sure lsp-dart and lsp-treemacs are latest from melpa unstable

Okay, i will compile all package again, in fact, i compiled it several hours ago, because i add a config which adviced by lsp offical document.

(setq lsp-use-plists t)

And, i use both of master, i can saw both changes are relative to this issue, if lsp-dart not work with above lsp config?

zw963 commented 2 years ago

sorry, i need more time to test, just ignore my previous comment.

zw963 commented 2 years ago

Hi, @ericdallo , i can confirm, when i set (setq lsp-use-plists t), which recommanded by lsp official document, will cause this error.

so, should i create a new issue for this?

please check https://emacs-lsp.github.io/lsp-mode/page/performance/

ericdallo commented 2 years ago

I never managed to make lsp-use-plists work for me, but I don't think it's a issue on lsp-dart. I suggest you ask on emacs-lsp's discord

zw963 commented 2 years ago

@ericdallo , i consider if we introduce new bug after this change.

e.g.

assume current opened buffer is 1.dart, i open flutter outline, it show 1.dart outline, it was as expected.

then, i open another one 2.dart buffer in another window, outline get updated as expected too.

but, when i switch back to 1.dart, flutter outline never updated.

All i have to do is, run lsp-dart-show-flutter-ouline again to make it take effect.

ericdallo commented 2 years ago

it's a old bug and not a new one, please open an issue with details so we can track the issue