~xerool/fennel-ls#9: 
Crash without workspace

Opening a file outside of a workspace crashes the server. rootUri is null.

$ codium foo.fnl

Part of the trace output:

Sending request 'initialize - (0)'.
Params: {
    "processId": 4060,
    "clientInfo": {
        "name": "VSCodium",
        "version": "1.78.2"
    },
    "locale": "en",
    "rootPath": null,
    "rootUri": null,
    "capabilities": {
      ...
    },
    "initializationOptions": {
      ...
    },
    "trace": "verbose",
    "workspaceFolders": null
}

Received response 'initialize - (0)' in 171ms.
Result: { ... }

Sending notification 'initialized'.
Params: {}

Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/user/test/foo.fnl",
        "languageId": "fennel",
        "version": 1,
        "text": "(λ foo [& args]\n  (print args))\n\n(λ 24)\n"
    }
}

Sending notification 'workspace/didChangeConfiguration'.
Params: { ... }

lua: ...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:7237: attempt to call a nil value (method 'sub')
stack traceback:
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:7237: in upvalue 'startswith'
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:7242: in function 'fennel-ls.utils.uri->path'
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:7602: in function 'fennel-ls.searcher.add-workspaces-to-path'
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:8141: in function 'fennel-ls.compiler.compile'
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:7435: in function 'fennel-ls.state.set-uri-contents'
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:528: in function <...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:517>
	(...tail calls...)
	...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:8944: in function <...um/User/globalStorage/adjuvant.fennel-ls/fennel-ls.0.4.2:8933>
	(...tail calls...)
	[C]: in ?

Connection to server got closed. Server will restart.
Status
REPORTED
Submitter
~adjuvant
Assigned to
No-one
Submitted
1 year, 2 months ago
Updated
5 months ago
Labels
bug

~xerool 6 months ago

I think I've got it working when rootUri is null. Fennel-ls now doesn't set a macro path or search the filesystem for files unless there is a rootUri.

Register here or Log in to comment, or comment via email.