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

[feature request] Provide detailed completion configurations and some enhancements. #742

Open
FlyinCow opened this issue Dec 4, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@FlyinCow
Copy link

FlyinCow commented Dec 4, 2024

I switch to clangd from ms-vscode.cpptools due to its significant performance issue, but it seems clangd does not have a detailed auto-completion configurations. This leads to some confliction to my code habit, and some behaviours are kind of annoying.

Examples:

ex1

image
If I accept this suggestion there will be brackets after class name, but I just want the class name only

ex2

image
I implement this class completely in a namespace, but when using delegating constructors clangd still provides namespace::

ex3

C_Cpp.autocompleteAddParentheses is a sweet option, but in clangd this is enforced open.

ex4

It seems there's some compatibility issue with MSVC, codes are compileable but clangd complains. For example, clangd complains that std::runtime_error is not a member of std with #include<excetion>. I do know that I should #include<stdexcept> but this code can be built without any warnings/errors.

@FlyinCow FlyinCow added the enhancement New feature or request label Dec 4, 2024
@FlyinCow
Copy link
Author

FlyinCow commented Dec 4, 2024

Another enhancement is, clangd doesn't support fuzzy matching in auto suggestion. Is this due to performance consideration?

@HighCommander4
Copy link
Contributor

Examples:

ex1

image If I accept this suggestion there will be brackets after class name, but I just want the class name only

In clangd 20, this behaviour can be achieved by adding the following to your .clangd config file:

Completion:
  ArgumentLists: None

ex2

image I implement this class completely in a namespace, but when using delegating constructors clangd still provides namespace::

Could you file this as a separate issue with a complete code example please?

ex3

C_Cpp.autocompleteAddParentheses is a sweet option, but in clangd this is enforced open.

ex4

Using ArgumentLists: None as mentioned above with prevent this as well.

It seems there's some compatibility issue with MSVC, codes are compileable but clangd complains. For example, clangd complains that std::runtime_error is not a member of std with #include<excetion>. I do know that I should #include<stdexcept> but this code can be built without any warnings/errors.

Please file this as a separate issue, with a code example and clangd logs.

Another enhancement is, clangd doesn't support fuzzy matching in auto suggestion. Is this due to performance consideration?

We do have some fuzzy matching. Can you give an example of what you expect to work but doesn't?

@FlyinCow
Copy link
Author

Examples:

ex1

image If I accept this suggestion there will be brackets after class name, but I just want the class name only

In clangd 20, this behaviour can be achieved by adding the following to your .clangd config file:

Completion:
  ArgumentLists: None

ex2

image I implement this class completely in a namespace, but when using delegating constructors clangd still provides namespace::

Could you file this as a separate issue with a complete code example please?

ex3

C_Cpp.autocompleteAddParentheses is a sweet option, but in clangd this is enforced open.

ex4

Using ArgumentLists: None as mentioned above with prevent this as well.

It seems there's some compatibility issue with MSVC, codes are compileable but clangd complains. For example, clangd complains that std::runtime_error is not a member of std with #include<excetion>. I do know that I should #include<stdexcept> but this code can be built without any warnings/errors.

Please file this as a separate issue, with a code example and clangd logs.

Another enhancement is, clangd doesn't support fuzzy matching in auto suggestion. Is this due to performance consideration?

We do have some fuzzy matching. Can you give an example of what you expect to work but doesn't?

I'll file seperated issues later for ex2 and ex4. As for last issue:
image
image
It dose have fuzzy matching but kind of strange for me. When I hit f t I thought clangd would match namespace fmt first but it didn't match it at all. When I hit f t p I thought clangd would match fmt::println (according to Lexicographic order) but there was even no pop-up window at all.

@HighCommander4
Copy link
Contributor

When I hit f t I thought clangd would match namespace fmt first but it didn't match it at all. When I hit f t p I thought clangd would match fmt::println (according to Lexicographic order) but there was even no pop-up window at all.

Thanks, I understand now.

I believe the current fuzzy matching rules break symbol names down into words/segments (e.g. false_type into false and type), and only match the beginnings of the segments, rather than any subsquence. This is why ft matches false_type but not fmt.

There are some issues on file about relaxing fuzzy matching: clangd/clangd#37, clangd/clangd#1236, clangd/clangd#2196.

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

2 participants