Skip to content

Unhandled method stops language server #1808

@arnoson

Description

@arnoson

I'm using lua-language-server together with Monaco editor in the browser via a websocket connection. Everything was working with some older binaries. Now I'm trying to use the latest binary for linux from the current release.

Monaco sends a workspace/configuration message which isn't known to the language server.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "workspace/configuration",
  "params": {
    "items": [
      {
        "section": "Lua"
      },
      {
        "section": "files.associations"
      },
      {
        "section": "files.exclude"
      },
      {
        "section": "editor.semanticHighlighting.enabled"
      },
      {
        "section": "editor.acceptSuggestionOnEnter"
      }
    ]
  }
}

In the previous version this error was only sent as a response to the browser, but the language server kept working (therefore I didn't even notice it).

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32601,
    "message": "Unhandled method workspace/configuration"
  }
}

Now the language server crashes due to an assert in lua.

[14:28:40.953][error][#0:script/await.lua:35]: script/proto/proto.lua:56: assertion failed!
stack traceback:
	[C]: in function 'assert'
	script/proto/proto.lua:56: in function 'proto.proto.response'
	script/proto/proto.lua:179: in local 'f'
	script/utility.lua:436: in metamethod 'close'
	script/proto/proto.lua:186: in function <script/proto/proto.lua:159>
stack traceback:
	script/await.lua:35: in function 'await.checkResult'
	(...tail calls...)
	script/await.lua:213: in function 'await.step'
	script/service/service.lua:170: in local 'doSomething'
	script/service/service.lua:189: in function 'service.eventLoop'
	script/service/service.lua:274: in function 'service.start'
	...co-lua-example/server/lua-language-server/linux/main.lua:79: in main chunk
	...ua-example/server/lua-language-server/linux/bin/main.lua:85: in main chunk
	[C]: in ?

I'm not sure if I can configure monaco to not send the workspace/configuration message. Is there anyway to ignore undhandled methods without crashing the language server?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions