Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New file isn't found in project #37

Open
cgay opened this issue Apr 22, 2024 · 1 comment
Open

New file isn't found in project #37

cgay opened this issue Apr 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@cgay
Copy link
Member

cgay commented Apr 22, 2024

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.

@cgay cgay added the enhancement New feature or request label Apr 22, 2024
@cgay
Copy link
Member Author

cgay commented May 20, 2024

In fact, the Module: header should be the first thing to look at, not just a fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant