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

lsp jump to def works poorly if file contains errors #89

Open
cjhopman opened this issue Aug 29, 2023 · 1 comment
Open

lsp jump to def works poorly if file contains errors #89

cjhopman opened this issue Aug 29, 2023 · 1 comment
Labels

Comments

@cjhopman
Copy link
Contributor

For this code:

def bad():

def foo():
  some_ref()

You can't jump-to-def on some_ref(). We do have a red squiggle for the bad function, so that's good. Maybe we should jump to the error.

For this:

def foo():
  some_ref()

def bad() -> UndefinedType.type:
  pass

You can't jump-to-def on some_ref(). We also don't identify the error with a red squiggle.

@cjhopman cjhopman changed the title starlark lsp jump to def works poorly if file contains errors lsp jump to def works poorly if file contains errors Aug 29, 2023
@MaartenStaa
Copy link
Contributor

Yeah, jump to definition (and most LSP things) don't work very well when there are parse errors. The LSP gets the new text of the source file, and tries to parse it. But as long as there are parse errors, it uses its last-known valid parse state, if any. Ideally the parser would handle such cases more gracefully.

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

No branches or pull requests

3 participants