-
Notifications
You must be signed in to change notification settings - Fork 163
Conversation
third_party/string_view.h
Outdated
@@ -1,6 +1,2 @@ | |||
#if __cplusplus >= 201703L || defined(__has_include) && __has_include(<string_view>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mac OS X, Xcode somehow includes <string_view>
so these lines cannot be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to sync my repository before submitting and this issue popped up, so this was just a quickfix.
This change should be a separate issue, which I assume others will encounter soon.
These changes sound great. We should keep the current name/detail split as an option though. Thanks for working on this! |
src/clang_complete.cc
Outdated
|
||
case CXCompletionChunk_LeftParen: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can clean this a bit to make you easier..
I agree that displaying the comments of the contect (e.g. Emacs company-lsp + company-quickhelp Does it look as nice in Emacs with your PR? |
Yeah it looks reasonable in Emacs, but I'd like to make some fixes to company-lsp once I get the feature into cquery. It's a bit difficult because VS Code seems to be tailored for LSP, but company mode has to adapt to look as cool, but I'm sure we can get something good too!
Ok, I will look at making this customizable then. |
|
5965eba
to
fc48e1d
Compare
Thanks @MaskRay for the pointer to the config, that was very helpful. Here are some screenshots: VS Code Emacs + company-lsp |
Some completion UI, such as Emacs' completion-at-point and company-lsp, display completion item label and detail side by side. This does not look right, when you see things like: "foo" "int foo()" "bar" "void bar(int i = 0)" When this option is enabled, the completion item label is very detailed, it shows the full signature of the candidate. The detail just contains the completion item parent context. Also, in this mode, functions with default arguments, generates one more item per default argument so that the right function call can be selected. That is, you get something like: "int foo()" "Foo" "void bar()" "Foo" "void bar(int i = 0)" "Foo" Be wary, this is quickly quite verbose, items can end up truncated by the UIs.
const auto lhsLabelLength = lhs.label.length(); | ||
const auto rhsFilterTextLength = rhs.filterText.length(); | ||
const auto rhsLabelLength = rhs.label.length(); | ||
return std::tie(lhs.found_, lhs.skip_, lhs.priority_, lhsFilterTextLength, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!lhs.found_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good catch, unexpected last-minute merge.
|
||
std::string text; | ||
switch (kind) { | ||
case CXCompletionChunk_LeftParen: text = '('; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 168 contains
case CXCompletionChunk_LeftParen: text = '('; break;
case CXCompletionChunk_RightParen: text = ')'; break;
Can they be less duplicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to understand, what do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another chunk of code below where these character branches (case CXCompletionChunk_LeftParen
) and string literals text = '('
are duplicated
Thx! Merged in 16dd874 |
First,
Thanks for cquery, this is a very promising project!
I'd like to propose some changes to the completion results.
You can find attached to this PR a draft implementation,
if you want to try it out.
I will be willing to clean it if there is interest in the changes I propose.
First, a list of the few things that I think could be improved:
This is mostly annoying an issue when the detail is "inline" (Ctrl + Space in VS Code).
but different arguments,
it is interesting to be able to pick up the right function at a glimpse,
with the snippet completing the arguments.
My solutions:
this is a new information we didn't have before.
This allow one to pick up the right signature directly.
so that you can pick up the right signature directly,
the same way you do with overloaded functions.
Before/After on custom/simplified struct:
Before/After with STL, heavy on the signature:
For reference, the boilerplate code I used for quick testing:
What do you think?
If you are positive, I will be glad to cleanup the PR for proper submission.