Comments (12)
@MarcoHassan the function lsp-f-canonical
is in lsp-mode.el
from lsp-treemacs.
@xuehy yes
@MarcoHassan Well, I did fix lsp-f-canonical
naively inplace and reevaluate the defun
. This modification actually breaks other important stuff.
I see 2 ways to approach the problem:
- Fix
lsp-f-ancestor-of?
since it is what fails here, or - understand why the diagnostics hashtable returned by
lsp-diagnostics
hasn't the correct casing in the first place.
As long as you stay on Windows, a quick and dirty way to do it is to replace lsp-f-ancestor-of?
with:
(defun lsp-f-ancestor-of? (path-a path-b)
"Return t if PATH-A is an ancestor of PATH-B.
Symlinks are not followed."
(unless (lsp-f-same? path-a path-b)
(s-prefix? (concat (lsp-f-canonical (downcase path-a)) (f-path-separator))
(lsp-f-canonical (downcase path-b)))))
Just edit-it in place in your .emacs.d/elpa
folder and restart emacs. It will probably be overwritten a the next package update.
from lsp-treemacs.
Hello,
No clue ?
I will test on linux, I wonder why it would work on linux and not on windows. How could it be platform dependent ?
A question of line ending (lf, crlf) ?
from lsp-treemacs.
Same thing happens in mac os. Additionally, when trying to unfold an error tree I get:
let: Wrong type argument: char-or-string-p, nil
from lsp-treemacs.
I am also facing the same issue, the nodes do not expand/unfold, @yyoncho any idea ?
from lsp-treemacs.
@asmodeus812 open separate issue, we have to debug it. As a side note, I favour helm-lsp-diagnostics
over lsp-treemacs
tree view.
from lsp-treemacs.
Still not solved? I am facing the same issue.
from lsp-treemacs.
@yyoncho I think @deb75 and @asmodeus812 are referring to the same issue in that the nodes simply don't expand, which I've got as well. helm-lsp-diagnostics displays the errors correctly, so I'm guessing it's not an LSP issue
from lsp-treemacs.
I am affected with the same issue under Windows 10, Emacs 29.0.50.
It turns out that the issue is in the function lsp-treemacs-errors--list-files
at line 1189. The function lsp-f-ancestor-of?
gets the folder of the workspace, and the path of a file that have diagnostics associated. On my machine, the case of the folder
is different than the case of the file
. For example, when debugging, I get in the *Message*
buffer:
Result: "c:/[Redacted]/AcmeCorp.PlanarMachining"
Result: "c:/[redacted]/acmecorp.planarmachining/visualizers/curve2d/curve2dvisualizer.test/obj/debug/net48/curve2dvisualizer.test.assemblyinfo.cs"
So, even if the folder contains the file according to the NTFS/whatever filesystem, lsp-f-ancestor-of?
returns nil
if the casing doesn't match exactly.
If you patch the function lsp-f-canonical
to downcase the filename like so:
(defun lsp-f-canonical (file-name)
"Return the canonical FILE-NAME, without a trailing slash."
(directory-file-name (expand-file-name (downcase file-name))))
Then the Error List
buffer shows the files with the diagnostics correctly: the tree can be expanded, and diagnostics double-clicked to navigate to the faulty code.
The above fix is probably not the right thing to do, but I couldn't find the proper way to do it. Honestly, comparing paths should be something that is delegated to some OS api, and everything that is done in Elisp is an approximation of that, at least on Windows...
Anyway, I hope that my little analysis helps with fixing the issue for the Windows users!
from lsp-treemacs.
Hi I am interested in the fix. Can you develop on it - in specific on the patch.
There is no function lsp-f-canonical
in here.
Are you suggesting replacing lsp-f-ancestor.of?
with it or what?
Thank you in advance.
from lsp-treemacs.
@thomashilke yes we must make sure the code only runs on windows. Since I use emacs on both win and Linux, here's my quick dirty fix which can be used in both OS:
(defun lsp-f-ancestor-of? (path-a-raw path-b-raw)
"Return t if PATH-A is an ancestor of PATH-B.
Symlinks are not followed."
(let ((path-a (if (eq system-type 'windows-nt) (downcase path-a-raw) (path-a-raw)))
(path-b (if (eq system-type 'windows-nt) (downcase path-b-raw) (path-b-raw))))
(unless (lsp-f-same? path-a path-b)
(s-prefix? (concat (lsp-f-canonical path-a) (f-path-separator))
(lsp-f-canonical path-b)))))
It seems that only fixing lsp-f-ancestor-of?
is still not enough with the error message
lsp--on-idle wrong type argument stringp nil
. Tracing the error, I found its root is function lsp-f-same?
. Finally, my patch is:
(defun lsp-f-ancestor-of-patch (path-args)
(mapcar (lambda (path) (downcase path)) path-args))
(when (eq system-type 'windows-nt)
(advice-add 'lsp-f-ancestor-of? :filter-args #'lsp-f-ancestor-of-patch)
(advice-add 'lsp-f-same? :filter-args #'lsp-f-ancestor-of-patch))
which can be placed in your own init files and will not be overwritten when lsp packages get updated.
from lsp-treemacs.
The above fix is probably not the right thing to do, but I couldn't find the proper way to do it. Honestly, comparing paths should be something that is delegated to some OS api,
There are OS calls(file-truename
) but we avoid them on purpose because they are pretty much killing lsp-mode performance. Thus all these ugly hacks.
I will accept this patch as a PR.
from lsp-treemacs.
Related Issues (20)
- dap-ui-sessions: Symbol’s value as variable is void: treemacs-\'lsp-treemacs-generic-root-extension-instance HOT 12
- make lsp-treemacs-call-hierarchy show location of call instead of only the caller's name
- No thread selected when debugging HOT 6
- Error when calling dap-ui-locals: (void-variable lsp-treemacs-generic-root) HOT 16
- doom emacs with java lsp error
- Expand by default HOT 1
- Treemacs not updating with `vue-semantic-server`
- Features' requests for symbols' tree: follow mode support + settings for folding depth on startup
- minor mode keymap missing?
- Error list keeps showing old cached results after the first render HOT 5
- lsp-treemacs-errors-list just appends to buffer, can't expand nodes HOT 3
- Error processing message (void-function icon). HOT 11
- Symbol's function definition is void: action HOT 1
- Icons of the LSP symbols are not being shown HOT 4
- `lsp-treemacs-call-hierarchy` doesn't work HOT 2
- file-missing "Cannot open load file" "No such file or directory" "treemacs-treelib" HOT 1
- How do you get views to open automatically
- Selecting windows
- Reusing a window with `treemacs-RET-action`
- Does `lsp-treemacs-errors-list` modify `treemacs-select-window`?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsp-treemacs.