Skip to content

New file isn't found in project #37

@cgay

Description

@cgay

If you have an existing project and emacs lsp-mode is working fine, and then you create a new file with contents

Module: my-module

define stuff...end;

and then you save the file, the LSP server doesn't find a module for the file and shows an error in the mode line. stderr looks like this (test.dylan is a new file):

D 2024-04-21T20:47:16.000-0400 [Main thread] Received JSON:
{
  "id": 226,
  "jsonrpc": "2.0",
  "method": "textDocument/hover",
  "params": {
    "position": {
      "character": 28,
      "line": 30
    },
    "textDocument": {
      "uri": "file:///Users/cgay/dylan/workspaces/deft/sources/commands/test.dylan"
    }
  }
}
D 2024-04-21T20:47:16.000-0400 [Main thread] textDocument/hover: No data found for {<open-document> file:///Users/cgay/dylan/workspaces/deft/sources/commands/test.dylan 7} (line: 30, column: 28)
D 2024-04-21T20:47:16.000-0400 [Main thread] Sent JSON:
{
  "id": 226,
  "jsonrpc": "2.0",
  "result": null
}

I believe this is because define handler textDocument/didOpen uses od/file-module to find the module. I think we need to fall back to looking for the Module: header and try to find the module by name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions