Solargraph: SolarGraph send kind: null on aliases, when the LSP standard demands a value:

Created on 2 Sep 2020  路  2Comments  路  Source: castwide/solargraph

Having the following ruby document:

class ClassName
  alias name1 name2
end

And sending this messages to solargraph:

Editor > SolarGraph

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":23788,"rootPath":"/home/hugo/src/rpm","rootUri":"file:///home/hugo/src/rpm","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":false},"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":false,"didSave":true},"definition":{"dynamicRegistration":false},"documentHighlight":{"dynamicRegistration":false},"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":false}}},"trace":"off","workspaceFolders":[{"uri":"file:///home/hugo/src/rpm","name":"project"}]}}

SolarGraph > Editor

{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".",":","@"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"hoverProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"definitionProvider":true,"renameProvider":{"prepareProvider":true},"referencesProvider":true,"workspaceSymbolProvider":true,"foldingRangeProvider":true}}}

Editor > SolarGraph

{"method":"initialized","params":{},"jsonrpc":"2.0"}

Editor > SolarGraph

{"method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/hugo/src/rpm/app/models/changes_tracker.rb","languageId":"ruby","version":1,"text":"class ClassName\n  alias name1 name2\nend\n"}},"jsonrpc":"2.0"}

Editor > SolarGraph

{"id":1,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///home/hugo/src/rpm/app/models/changes_tracker.rb"}},"jsonrpc":"2.0"}

SolarGraph > Editor

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "name": "ClassName",
            "containerName": "",
            "kind": 5,
            "location": {
                "uri": "file:///home/hugo/src/rpm/app/models/changes_tracker.rb",
                "range": {
                    "start": {
                        "line": 0,
                        "character": 0
                    },
                    "end": {
                        "line": 2,
                        "character": 3
                    }
                }
            },
            "deprecated": false
        },
        {
            "name": "name1",
            "containerName": "ClassName",
            "kind": null,
            "location": {
                "uri": "file:///home/hugo/src/rpm/app/models/changes_tracker.rb",
                "range": {
                    "start": {
                        "line": 1,
                        "character": 2
                    },
                    "end": {
                        "line": 1,
                        "character": 19
                    }
                }
            },
            "deprecated": false
        }
    ]
}

It sent kind: null for the alias, where the spec says the kind field should be a SymbolKind, defined by:

/**
 * A symbol kind.
 */
export namespace SymbolKind {
    export const File = 1;
    export const Module = 2;
    export const Namespace = 3;
    export const Package = 4;
    export const Class = 5;
    export const Method = 6;
    export const Property = 7;
    export const Field = 8;
    export const Constructor = 9;
    export const Enum = 10;
    export const Interface = 11;
    export const Function = 12;
    export const Variable = 13;
    export const Constant = 14;
    export const String = 15;
    export const Number = 16;
    export const Boolean = 17;
    export const Array = 18;
    export const Object = 19;
    export const Key = 20;
    export const Null = 21;
    export const EnumMember = 22;
    export const Struct = 23;
    export const Event = 24;
    export const Operator = 25;
    export const TypeParameter = 26;
}

Is this a solagraph extension to the protocol? if so, is there a way to disable it?

bug

All 2 comments

Not an extension, just an oversight. I'll fix it in the next patch release.

Fixed in v0.39.16.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dgutov picture dgutov  路  5Comments

megalithic picture megalithic  路  3Comments

PyvesB picture PyvesB  路  4Comments

tylerlu94 picture tylerlu94  路  5Comments

castwide picture castwide  路  4Comments