Git Product home page Git Product logo

Comments (2)

rgrunber avatar rgrunber commented on September 23, 2024

textDocument/documentSymbols supports both a list of SymbolInformation & DocumentSymbol. DocumentSymbol is the one that includes a range & selectionRange.

It looks like JDT-LS is only returning what appears to be SymbolInformation for you. Is your client setting hierarchicalDocumentSymbolSupport? If you aren't then JDT-LS will continue to return non-hierarchical symbols, which lack the API to specify both ranges :

if (preferenceManager.getClientPreferences().isHierarchicalDocumentSymbolSupported()) {
List<DocumentSymbol> symbols = this.getHierarchicalOutline(unit, monitor);
return symbols.stream().map(Either::<SymbolInformation, DocumentSymbol>forRight).collect(toList());
} else {
SymbolInformation[] elements = this.getOutline(unit, monitor);
return Arrays.asList(elements).stream().map(Either::<SymbolInformation, DocumentSymbol>forLeft).collect(toList());
}

Part of the issue is we didn't migrate our non-hierarchical textDocument/documentSymbols implementation to also use DocumentSymbol (it still uses SymbolInformation).

from eclipse.jdt.ls.

Instein98 avatar Instein98 commented on September 23, 2024

Hi Roland, thanks so much for your prompt reply, I really appreciate it. After specifying hierarchicalDocumentSymbolSupport to be true, I got what I wanted.

Specifically, in the initialize message, I specified:

"documentSymbol": {
    "dynamicRegistration": false,
    "symbolKind": {
        "valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
    },
    "hierarchicalDocumentSymbolSupport": true,
    "tagSupport": {
        "valueSet": [1]
    },
    "labelSupport": true
    },

Since the issue has been resolved, please feel free to close this issue. Thanks again.

from eclipse.jdt.ls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.