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: Show auto-complete types instead of the module names #3323

Closed
Zhomart opened this issue Jun 23, 2024 · 7 comments
Closed

LSP: Show auto-complete types instead of the module names #3323

Zhomart opened this issue Jun 23, 2024 · 7 comments

Comments

@Zhomart
Copy link
Contributor

Zhomart commented Jun 23, 2024

Gleam:
image

How other languages do:

Rust:
image

Typescript (only on select):
image

Golang (only on select):
image

I've created a PR to showcase this (#3322), what do you think?

@lpil
Copy link
Member

lpil commented Jun 23, 2024

The examples you've given here don't support removing the module in my eyes.

Rust: it prominently shows the module first of all. When there is not enough space for the module and the type it shows only the module.

TypeScript: The module is used in the code to filter the suggestions so they all belong to the same module. In this case it is safe to only show the type.

Go: This is completion on an object rather than generally so no modules are included.

It is vital that there is a way for the programmer to be able to tell what module each item comes from. Today we show both the module and the type, with the type being in the further details section, which you have collapsed in VSCode so it does not show.

We could adopt the Rust approach where it shows the type information inline in the instance there is enough space after the module, or we could take some other approach so long as the module is always clear.

@Zhomart
Copy link
Contributor Author

Zhomart commented Jul 6, 2024

I believe gleam should show type information. This helps engineers during coding.

It seems like we can use field to show type informaiton. Let me try create PR and see if it works.

image

@Zhomart
Copy link
Contributor Author

Zhomart commented Jul 6, 2024

Hi @lpil, please take a look at this (#3364) example. VSCode shows it nicely. What do you think?

@lpil
Copy link
Member

lpil commented Jul 7, 2024

Hello! Please reply to my comments above 🙏

@Zhomart
Copy link
Contributor Author

Zhomart commented Jul 7, 2024

The examples you've given here don't support removing the module in my eyes.

Rust: it prominently shows the module first of all. When there is not enough space for the module and the type it shows only the module.

TypeScript: The module is used in the code to filter the suggestions so they all belong to the same module. In this case it is safe to only show the type.

Go: This is completion on an object rather than generally so no modules are included.

It is vital that there is a way for the programmer to be able to tell what module each item comes from. Today we show both the module and the type, with the type being in the further details section, which you have collapsed in VSCode so it does not show.

We could adopt the Rust approach where it shows the type information inline in the instance there is enough space after the module, or we could take some other approach so long as the module is always clear.

I still think showing types inline is good for engineers. Here's an example that shows both type information and module name. What do you think?

Example implementation: #3364

image

@lpil
Copy link
Member

lpil commented Jul 8, 2024

Sorry, I must have been unclear in my previous message. How does that present the information when there is insufficient space for both, when you are using the more detailed (default?) completion UI in VSCode, and in other editors? Thank you

@Zhomart
Copy link
Contributor Author

Zhomart commented Jul 13, 2024

VSCode:

When window is too small, this is what we get:
image

This is 50% of 14" screen:

image

This issue was open for some time, and it looks like it didn't get any support (except me :) ). I'll close it, as it looks like people prefer the current approach.

@Zhomart Zhomart closed this as completed Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants