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

Unable to give completions to LSP for dot completions #3036

Closed
u9g opened this issue Apr 23, 2024 · 2 comments
Closed

Unable to give completions to LSP for dot completions #3036

u9g opened this issue Apr 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@u9g
Copy link

u9g commented Apr 23, 2024

The following code can't be completed using ctrl+space because it fails to parse.

import ct/reflection
import ct/item

pub fn get_item_from_give_code(give_code: String) -> item.Item {
  reflection.
}

You will not know about it though, as compilation silently fails, however when I remove the silent failing, we get the following error:

Panic: C:\Users\---\Documents\code\4-20-24\gleam\compiler-core\src\build\package_compiler.rs:123
	called `Result::unwrap()` on an `Err` value: Parse { path: "c:\\Users\\Jason\\Documents\\code\\4-20-24\\examplemod\\src\\ct\\act.gleam", src: "import ct/reflection\r\nimport ct/item\r\n\r\npub fn get_item_from_give_code(give_code: String) -> item.Item {\r\n  reflection.\r\n  todo\r\n}\r\n", error: ParseError { error: UnexpectedToken { expected: ["A positive integer or a field name."], hint: None }, location: SrcSpan { start: 123, end: 128 } } }

This is a big problem because if we always need completely valid code to offer completions, we can never offer dot completions.

I'm not sure what the next steps are here but I am open to ideas. Maybe something like adding a placeholder for XX.\n to the parser that will allow us to finish parsing the line so that we can still get diagnostics?

@u9g u9g added the bug Something isn't working label Apr 23, 2024
@u9g
Copy link
Author

u9g commented Apr 23, 2024

Another thing to consider is that the user has no idea there is a parse error if we silently dispose of parse errors.

@lpil
Copy link
Member

lpil commented Apr 23, 2024

Hello! This is not implemented yet.

@lpil lpil closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants