Closed zw963 closed 2 years ago
Hum, that's weird, I use native-comp and can't repro this. any thoughts @yyoncho ?
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:
thanks, I'll follow that and try to understand what is happening
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>)
mapcar(#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>])
treemacs--do-expand-node(#<marker (moves after insertion) at 726 in Flutter Outline>) treemacs-expand-node()
-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)
-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>)
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 #
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>))
it could be a server bug as well, what flutter/dart version are you using?
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
Yes, it feels very smooth to me, no issues ATM 🤔
Let me try testing with your flutter version
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.
Even so, nothing lagging to me, will test with your flutter, one sec
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)
@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
what is your output of lsp-doctor
?
(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
I usually use https://github.com/ericdallo/flutter_sample for testing lsp-dart stuff
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 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?
or, you can try on this i created just now.
Sure, will test it
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
Everything looks pretty fast to me with your zip project 😔
Note: the gif is using 24fps not 30
No clue, sounds like some missing emacs optimization
No clue, sounds like some missing emacs optimization
are you install emacs use compile? could you please share your's configure config?
Note: the gif is using 24fps not 30
Your's emacs IDE is so so so fast!
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
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 ?
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
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.
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 ...
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?
I don't think so, never saw this kind of performance issue besides configs 🤔
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))
Okay, maybe my laptop performance was too bad, is there a way to disable this feature after enable it?
yes, (setq lsp-dart-outline nil)
and (setq lsp-dart-flutter-outline nil)
should disable it
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.
Everything looks pretty fast to me with your zip project pensive
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.
dart one no icon.
I guess those icon cause this issue? can we test on both command, but not enable icon?
I doubt it's the icon, but it worth the test
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.
Good news @zw963 for me the flutter outline is slow as well!, there is certainly something to improve on lsp-dart :)
@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 :)
@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
@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 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?
sorry, i need more time to test, just ignore my previous comment.
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/
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
@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.
it's a old bug and not a new one, please open an issue with details so we can track the issue
Describe the bug
I create a new file like this:
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.
But, if editing on a exists file, it is Okay.
Sorry for i don't know how to disable native compile for this case.