Skip to content

Server doesn't initialize #1310

@jwortmann

Description

@jwortmann

Once every few months I update the language server version that is used by the client for Sublime Text.
It seems that the version of the latest commit d8bf74c does not initialize with this client:

:: [16:20:44.004] --> julia initialize (1): {'processId': 12516, 'clientInfo': {'name': 'Sublime Text LSP', 'version': '2.1.0'}, 'rootUri': 'file:///C:/Users/jwortmann/.julia/packages/LanguageServer/LTj3Y', 'rootPath': 'C:\\Users\\jwortmann\\.julia\\packages\\LanguageServer\\LTj3Y', 'workspaceFolders': [{'name': 'LTj3Y', 'uri': 'file:///C:/Users/jwortmann/.julia/packages/LanguageServer/LTj3Y'}], 'capabilities': {'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}}, 'textDocument': {'synchronization': {'dynamicRegistration': True, 'didSave': True, 'willSave': True, 'willSaveWaitUntil': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'completion': {'dynamicRegistration': True, 'completionItem': {'snippetSupport': True, 'deprecatedSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'insertReplaceSupport': True, 'insertTextModeSupport': {'valueSet': [2]}, 'labelDetailsSupport': True}, 'completionItemKind': {'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]}, 'insertTextMode': 2, 'completionList': {'itemDefaults': ['editRange', 'insertTextFormat', 'data']}}, 'signatureHelp': {'dynamicRegistration': True, 'contextSupport': True, 'signatureInformation': {'activeParameterSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}}}, 'references': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'dynamicRegistration': True, 'hierarchicalDocumentSymbolSupport': True, '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]}, 'tagSupport': {'valueSet': [1]}}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True, 'rangesSupport': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'dynamicRegistration': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.fixAll', 'source.organizeImports']}}, 'dataSupport': True, 'isPreferredSupport': True, 'resolveSupport': {'properties': ['edit']}}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True, 'prepareSupportDefaultBehavior': 1}, 'colorProvider': {'dynamicRegistration': True}, 'publishDiagnostics': {'relatedInformation': True, 'tagSupport': {'valueSet': [1, 2]}, 'versionSupport': True, 'codeDescriptionSupport': True, 'dataSupport': True}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': True}, 'selectionRange': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'foldingRangeKind': {'valueSet': ['comment', 'imports', 'region']}}, 'codeLens': {'dynamicRegistration': True}, 'inlayHint': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['textEdits', 'label.command']}}, 'semanticTokens': {'dynamicRegistration': True, 'requests': {'range': True, 'full': {'delta': True}}, 'tokenTypes': ['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'], 'tokenModifiers': ['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'], 'formats': ['relative'], 'overlappingTokenSupport': False, 'multilineTokenSupport': True, 'augmentsSyntaxTokens': True}, 'callHierarchy': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}}, 'workspace': {'applyEdit': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'executeCommand': {}, 'workspaceEdit': {'documentChanges': True, 'failureHandling': 'abort'}, 'workspaceFolders': True, 'symbol': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['location.range']}, '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]}, 'tagSupport': {'valueSet': [1]}}, 'configuration': True, 'codeLens': {'refreshSupport': True}, 'inlayHint': {'refreshSupport': True}, 'semanticTokens': {'refreshSupport': True}, 'diagnostics': {'refreshSupport': True}}, 'window': {'showDocument': {'support': True}, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'workDoneProgress': True}}, 'initializationOptions': {'julialangTestItemIdentification': True}}
:: [16:20:50.645] <<< julia (1) (duration: 6641ms): {'capabilities': {'completionProvider': {'resolveProvider': False, 'triggerCharacters': ['.', '@', '"', '^']}, 'hoverProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'declarationProvider': False, 'definitionProvider': True, 'typeDefinitionProvider': False, 'implementationProvider': False, 'referencesProvider': True, 'documentHighlightProvider': True, 'documentSymbolProvider': True, 'codeActionProvider': True, 'documentLinkProvider': {'resolveProvider': False}, 'colorProvider': False, 'documentFormattingProvider': True, 'documentRangeFormattingProvider': True, 'renameProvider': {'prepareProvider': True}, 'foldingRangeProvider': False, 'executeCommandProvider': {'commands': ['UpdateDocstringSignature', 'CompareNothingWithTripleEqual', 'AddDocstringTemplate', 'FixMissingRef', 'ReexportModule', 'ReplaceUnusedAssignmentName', 'ExpandFunction', 'RewriteAsRawString', 'ExplicitPackageVarImport', 'DeleteUnusedFunctionArgumentName', 'OrganizeImports', 'AddLicenseIdentifier', 'RewriteAsRegularString']}, 'selectionRangeProvider': True, 'inlayHintProvider': True, 'workspaceSymbolProvider': True, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'textDocumentSync': {'change': {'syncKind': 2}, 'didOpen': {}, 'didClose': {}, 'save': {'includeText': True}}}}
:: [16:20:50.647]  -> julia initialized: {}
:: [16:20:50.648]  -> julia workspace/didChangeConfiguration: {'settings': {'julia': {'completionmode': 'exportedonly', 'inlayHints': {'static': {'enabled': True, 'parameterNames': {'enabled': 'literals'}, 'variableTypes': {'enabled': True}}}, 'lint': {'call': True, 'constif': True, 'datadecl': True, 'disabledDirs': ['docs', 'test'], 'iter': True, 'lazy': True, 'missingrefs': 'symbols', 'modname': True, 'nothingcomp': True, 'pirates': True, 'run': True, 'typeparam': True, 'useoffuncargs': True}}}}
:: [16:20:50.661]  -> julia textDocument/didOpen: {'textDocument': {'uri': 'file:///C:/Users/jwortmann/.julia/packages/LanguageServer/LTj3Y/src/LanguageServer.jl', 'languageId': 'julia', 'version': 0, 'text': 'module LanguageServer\nusing JSON, REPL, CSTParser, JuliaFormatter, SymbolServer, StaticLint\nusing CSTParser: EXPR, Tokenize.Tokens, Tokenize.Tokens.kind, headof, parentof, valof, to_codeobject\nusing StaticLint: refof, scopeof, bindingof\nusing UUIDs\nusing Base.Docs, Markdown\nimport JSONRPC\nusing JSONRPC: Outbound, @dict_readable\nimport Logging\nimport JuliaWorkspaces\nusing JuliaWorkspaces: JuliaWorkspace, URIs2\nusing JuliaWorkspaces.URIs2: URI, uri2filepath, filepath2uri\nusing PrecompileTools\n\nexport LanguageServerInstance, runserver\n\nJSON.lower(uri::URI) = string(uri)\n\ninclude("exception_types.jl")\ninclude("protocol/protocol.jl")\ninclude("extensions/extensions.jl")\ninclude("textdocument.jl")\ninclude("document.jl")\ninclude("languageserverinstance.jl")\ninclude("multienv.jl")\ninclude("runserver.jl")\ninclude("staticlint.jl")\n\ninclude("requests/misc.jl")\ninclude("requests/textdocument.jl")\ninclude("requests/features.jl")\ninclude("requests/hover.jl")\ninclude("requests/completions.jl")\ninclude("requests/workspace.jl")\ninclude("requests/actions.jl")\ninclude("requests/init.jl")\ninclude("requests/signatures.jl")\ninclude("requests/highlight.jl")\ninclude("requests/testing.jl")\ninclude("utilities.jl")\ninclude("precompile.jl")\n\nend\n'}}
:: [16:20:50.667] --> julia textDocument/documentLink (2): {'textDocument': {'uri': 'file:///C:/Users/jwortmann/.julia/packages/LanguageServer/LTj3Y/src/LanguageServer.jl'}}
:: [16:20:51.893] <-- julia client/registerCapability (414433df-5c01-4581-b602-386c5c325b4f): {'registrations': [{'id': '45628459-e2a7-4304-8dde-be1734ec30e2', 'method': 'workspace/didChangeConfiguration'}]}
:: [16:20:51.893] >>> julia (414433df-5c01-4581-b602-386c5c325b4f) (duration: 0ms): None
julia: ERROR: This should not happen
julia: Stacktrace:
julia:  [1] error(s::String)
julia:    @ Base .\error.jl:35
julia:  [2] initialized_notification(params::LanguageServer.InitializedParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint})
julia:    @ LanguageServer C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\requests\init.jl:230
julia:  [3] (::LanguageServer.var"#108#109"{typeof(LanguageServer.initialized_notification), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.InitializedParams)
julia:    @ LanguageServer C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\languageserverinstance.jl:283
julia:  [4] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any})
julia:    @ JSONRPC C:\Users\jwortmann\.julia\packages\JSONRPC\Q0FBr\src\typed.jl:67
julia:  [5] run(server::LanguageServerInstance; timings::Vector{Any})
julia:    @ LanguageServer C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\languageserverinstance.jl:416
julia:  [6] run
julia:    @ C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\languageserverinstance.jl:293 [inlined]
julia:  [7] runserver(pipe_in::Base.PipeEndpoint, pipe_out::Base.PipeEndpoint, env_path::String, depot_path::String, err_handler::Nothing, symserver_store_path::Nothing)
julia:    @ LanguageServer C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\runserver.jl:41
julia:  [8] runserver()
julia:    @ LanguageServer C:\Users\jwortmann\.julia\packages\LanguageServer\LTj3Y\src\runserver.jl:39
julia:  [9] top-level scope
julia:    @ none:1

So for debugging I added the following statements where the error is thrown at

error("This should not happen")

@info "Debugging" file_full_path
@info "Debugging" server.workspaceFolders
@info "Debugging" server._files_from_disc
@info "Debugging" uri

giving me the results

julia: ┌ Info: Debugging
julia: └   file_full_path = "C:\\Users\\jwortmann\\.julia\\packages\\LanguageServer\\LTj3Y\\Project.toml"
julia: ┌ Info: Debugging
julia: │   server.workspaceFolders =
julia: │    Set{String} with 1 element:
julia: └      "c:\\Users\\jwortmann\\.julia\\packages\\LanguageServer\\LTj3Y"
julia: ┌ Info: Debugging
julia: │   server._files_from_disc =
julia: │    Dict{JuliaWorkspaces.URIs2.URI, JuliaWorkspaces.TextFile} with 62 entries:
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: │      URI("file", "", "/c:/U… => TextFile(URI("file", "", "/c:/Users/jwortmann…
julia: └      ⋮                       => ⋮
julia: ┌ Info: Debugging
julia: └   uri = JuliaWorkspaces.URIs2.URI("file", "", "/c:/Users/jwortmann/.julia/packages/LanguageServer/LTj3Y/Project.toml", nothing, nothing)

Note that the Sublime client uses URIs with the canonical Windows filepaths with uppercase drive letter, while LanguageServer.jl normalizes some/most paths to lowercase drive letters. So I assume that here the startswith function doesn't give the expected result at

if all(i->!startswith(file_full_path, i), server.workspaceFolders)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions