Comments (12)
I pushed a fix about the duplicate name.
from lsp-treemacs.
Yes, please ignore the previous comment, apparently, there is pyls specific an issue. I will investigate.
from lsp-treemacs.
No, it is an issue in lsp-treemacs-symbols , I will fix it. It is caused by pyls not returning hierarchical elements. This was the old documentSymbols format.
from lsp-treemacs.
Proposed fix at #27
I will test it for some time before before merging.
from lsp-treemacs.
Can you post a screenshot about the identation issues?
from lsp-treemacs.
Using this Python code:
import os
import sys
class Example:
def __init__(self):
self.x = 1
I would expect lsp-treemacs-symbols-list to display the symbols like, say:
os
sys
Example
__init__
x
What I get is (with your 2nd defun):
What I get (with the 1st defun):
It looks like (seq-empty-p children)
is always true.
FWIW, evaluating
(lsp-request "textDocument/documentSymbol" `(:textDocument ,(lsp--text-document-identifier)))
in my code buffer gives me:
(#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name os containerName nil location #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (uri file:///mnt/projects/t.py range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 0)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 9)))))) kind 2)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name sys containerName nil location #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (uri file:///mnt/projects/t.py range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 0)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 10)))))) kind 2)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name Example containerName nil location #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (uri file:///mnt/projects/t.py range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 3 character 0)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 6 character 0)))))) kind 5)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name __init__ containerName Example location #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (uri file:///mnt/projects/t.py range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 4)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 6 character 0)))))) kind 12)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name x containerName __init__ location #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (uri file:///mnt/projects/t.py range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 5 character 8)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 5 character 18)))))) kind 13)))
Not sure if children
is supposed to be included in this return value, but it does include a containerName
reference.
I am using Palantir's python language server for this (https://github.com/palantir/python-language-server) not the MS one, if that makes a difference.
from lsp-treemacs.
Ah, I see - the offset is the expected behaviour here it is the explanation:
Note that in order to have the nodes without children aligned to the nodes with children aligned we have to indent then in the same way.
from lsp-treemacs.
Shouldn't the expected behavior though be to have, for example, __init__
indented as a child of Example
, since it is a method?
from lsp-treemacs.
Using the MS python language server seems to fix the indentation issue:
And this backend does return a children
node:
(#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name os kind 2 deprecated nil range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 7)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 9)))) selectionRange #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 7)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 0 character 9)))) children [])) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name sys kind 2 deprecated nil range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 7)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 10)))) selectionRange #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 7)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 1 character 10)))) children [])) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name Example kind 5 deprecated nil range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 3 character 0)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 5 character 18)))) selectionRange #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 3 character 6)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 3 character 13)))) children [#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name __init__ kind 9 deprecated nil range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 4)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 5 character 18)))) selectionRange #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 8)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 16)))) children [#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (name self kind 13 deprecated nil range #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 17)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 21)))) selectionRange #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (start #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 17)) end #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (line 4 character 21)))) children []))]))])))
Note though that self.x
doesn't show up in the symbols list, but it's also not being returned from the backend as far as I can tell. So maybe I need to fool around with the config options for this LSP server.
from lsp-treemacs.
Thanks. The patch is working well for me so far!
from lsp-treemacs.
Actually, I noticed the symbols list is being truncated after the first class or defun. For example:
def test():
x = 20
class Something:
def __init__(self):
x = 20
def what(self):
y = 90
and
class Something:
def __init__(self):
x = 20
def what(self):
y = 90
def test():
x = 20
Note that there looks to be a partial problem with indentation.
from lsp-treemacs.
@algoterranean pushed a fix, I was using the wrong function -split-with instead of -separate.
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.