Open asmodeus812 opened 2 years ago
I have similar issue on windows when using ^M line endings. Can you do the following: M-: (set-buffer-file-coding-system 'undecided-unix nil)
, save the buffer, close the buffer and then open it again.
I have similar issue on windows when using ^M line endings. Can you do the following:
M-: (set-buffer-file-coding-system 'undecided-unix nil)
, save the buffer, close the buffer and then open it again.
Hi Just Tried that but nothing really changed. Also I should have noted that I am opening already exisisting IntelliJ based project files which have by default LF encoding and .projectfile, pom and .classpath files in the root directory. In the messages buffer i can now see that the server is throwing an internal error. Updated my OP
That error matches my guess. Can you do C-s C-q C-m RET
? Can you test with a new file? Can you test with another project (like this one https://github.com/emacs-lsp/lsp-mode/tree/master/test/fixtures/org-mode/java-project, make sure to pick the correct project root).
That error matches my guess. Can you do
C-s C-q C-m RET
? Can you test with a new file? Can you test with another project (like this one https://github.com/emacs-lsp/lsp-mode/tree/master/test/fixtures/org-mode/java-project, make sure to pick the correct project root).
I tried to download the test project, and mimic the problem, same issue seems to be present.
PS. The way I load the project is by loading the in emacs pom after which i open a file from the project in a buffer, the minibuffer log shows that the server has started successfully. And The workspace is created.
based on the screenshot you have selected wrong project root. Use M-x lsp-workspace-folders-add/remove and make sure that you have added the folder that contains pom.xml
@yyoncho Thanks, tried to run lsp-workspace-folders-add and typed in the full directory anyway. Seems that the workspace is created correctly, when i type lsp-describe-session I can see the workspace (the project root folder where the pom is) Also when i try to run lsp-workspace-folders-remove i can select that workspace and can remove it. I found out that dragging, dropping the pom in emacs seems to automatically create the workspace anyway. But the issue still persists, I am probably missing something.
can you try using lsp-start-plain.el as described here https://github.com/emacs-lsp/lsp-mode/issues/new?assignees=&labels=bug&template=bug_report.yml ? There is something in your enviroment that causing these issues, let's see if it will work with clean config.
@yyoncho I have made some progress regarding the configuration, made sure to test with the .el your provided above, and replicated the same config in my .emacs file. As it turns out it seems to be working okay now. Pasting the relevant configuration, let me know if you find something that is misplaced.
I am not sure what this is:
gc-cons-threshold (* 100 1024 1024) read-process-output-max (* 1024 1024)
Noticed a problem with sideline, while very useful i wanted to disable the hideous wall of text next to the code that was showing actions and diagnostics, and simply use lsp-ui-sideline-apply-code-actions to see them in the minibuffer. Sadly i was able to hide the text but not able to make list of available actions for a symbol show, with the config below, lsp-ui-sideline-apply-code-actions says - No code actions on the current line
lsp-ui-sideline-enable t lsp-ui-sideline-show-hover nil lsp-ui-sideline-show-symbol nil lsp-ui-sideline-show-diagnostics nil lsp-ui-sideline-show-code-actions nil
LSP Configuration `(let* ((pkg-list '(
lsp-mode lsp-ui yasnippet lsp-java
lsp-python-ms lsp-haskell
helm-lsp lsp-treemacs dap-mode
lsp-origami lsp-dart lsp-pyright
company flycheck which-key
rust-mode php-mode scala-mode yaml-mode
dart-mode clojure-mode typescript-mode
json-mode js2-mode
)
) ) (mapc (lambda (pkg) (unless (package-installed-p pkg) (package-install pkg)) (require pkg)) pkg-list ) )
(which-key-mode) (yas-global-mode) (global-flycheck-mode)
(add-hook 'c-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp) (add-hook 'java-mode-hook 'lsp)
(add-hook 'prog-mode-hook 'lsp) (add-hook 'after-init-hook 'global-company-mode) (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(setq treemacs-space-between-root-nodes nil company-selection-wrap-around t company-minimum-prefix-length 1
lsp-prefer-capf t
lsp-use-lsp-ui t
lsp-lens-enable t
lsp-headerline-breadcrumb-enable t
lsp-ui-doc-delay 0.2
lsp-ui-doc-show-with-mouse t
lsp-ui-doc-show-with-cursor nil
lsp-ui-sideline-enable t
lsp-java-format-enabled t
lsp-java-format-comments-enabled t
lsp-java-save-action-organize-imports t
lsp-java-save-action-organize-imports t
lsp-java-import-gradle-enabled t
lsp-java-import-maven-enabled t
lsp-java-vmargs '("-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Xmx2048m" "-Xms256m"))
` Le
@yyoncho Thanks,already had a look at it and followed it yesterday, but as i said above, hiding the sideline actually completely disabled the apply-actions, if that is by design, is there not a way to not show the actions constantly when your cursor is over a symbol and still have access to them, seems like a reasonable thing.
Use M-x lsp-execute-code-action for executing code actions.
@yyoncho That is helpful, the issue with that is that this shows all available actions, not the ones that are only valid for the symbol currently being hovered over. Which is only available with the apply fun.
That is the right thing to do from lsp-mode's perspective. In general, lsp-ui method should go away. If you want to have a method that shows only the refactorings and fixes without source level code actions you can create custom method. You may follow lsp-execute-code-action-by-kind
as an example.
@yyoncho Thanks, will look into it. I have a few more queries but i reckon i can go over to the discord chat, I think we can close this ticket. Thanks for the Help !
Just to summarize, for anyone in the future reading this - I made sure to clear all emacs packages and cache from - C:\Users\
I am facing an issue with lsp and lsp-java in particular, being unable to properly list and suggest symbols for a given type. A few issues i noticed When i start typing the name of a local variable nothing happens, no suggestions are available, when i try to type a function which i know belongs to a given type, on a local variable of that type, same problem. The Same issue with enums and so on, basically everything is crippled and the server reports errors. For example when i type down a local variable (of type List) and expect to get suggestions for the available methods of that type I am receiving the following error - error "Cannot find types for
\"MANDATORY_ENVIRONMENT_TYPES\"
". I am quite new in the lsp world, i was not able to find a solution to the problem browsing through the issues here.`(use-package yasnippet :ensure t :pin melpa :config (yas-global-mode))
(use-package which-key :ensure t :pin melpa :config (which-key-mode))
(use-package flycheck :ensure t :pin melpa :init (global-flycheck-mode))
(use-package company :ensure t :pin melpa :config (add-hook 'after-init-hook 'global-company-mode))
(use-package lsp-mode :ensure t :pin melpa :hook ((lsp-mode . lsp-enable-which-key-integration)) :config (setq lsp-completion-enable-additional-text-edit nil))
(use-package lsp-java :ensure t :pin melpa)
(use-package lsp-ui :ensure t :pin melpa)
(use-package lsp-treemacs :ensure t :pin melpa)
(use-package helm-lsp :ensure t :after (lsp-mode) :commands (helm-lsp-workspace-symbol) :init (define-key lsp-mode-map [remap xref-find-apropos] #'helm-lsp-workspace-symbol))
(require 'lsp) (require 'lsp-mode)
(add-hook 'c-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp) (add-hook 'java-mode-hook 'lsp)
(add-hook 'company-completion-started-hook (lambda (&rest _) (setq-local lsp-inhibit-lsp-hooks t) (lsp--capf-clear-cache)) nil t)
(setq gc-cons-threshold ( 100 1024 1024) read-process-output-max ( 1024 1024) treemacs-space-between-root-nodes nil company-selection-wrap-around t company-minimum-prefix-length 1 company-idle-delay 0.0 lsp-prefer-capf t lsp-use-lsp-ui t lsp-idle-delay 0.1 lsp-lens-enable t lsp-headerline-breadcrumb-enable t lsp-ui-doc-delay 0.1 lsp-ui-doc-show-with-mouse t lsp-ui-doc-show-with-cursor nil lsp-ui-sideline-enable t lsp-java-format-enabled t lsp-java-format-comments-enabled t lsp-java-save-action-organize-imports t lsp-java-save-action-organize-imports t lsp-java-import-gradle-enabled t lsp-java-import-maven-enabled t lsp-java-auto-build t lsp-print-io t lsp-java-vmargs '("-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Xmx2048m" "-Xms256m"))`
`Nov 26, 2021, 7:04:13 PM >> document/didChange Nov 26, 2021, 7:04:13 PM BadLocationException null org.eclipse.jface.text.BadLocationException
`