-
Notifications
You must be signed in to change notification settings - Fork 18
returned an error each time something bad occurred. #190
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,20 +22,20 @@ import ( | |
) | ||
|
||
// SignatureHelp is required by the protocol.Server interface. | ||
func (s *server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) { | ||
func (s *server) SignatureHelp(_ context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) { | ||
location, err := s.cache.Find(¶ms.TextDocumentPositionParams) | ||
if err != nil { | ||
return nil, nil | ||
return nil, err | ||
} | ||
|
||
call, ok := location.Node.(*promql.Call) | ||
if !ok { | ||
return nil, nil | ||
return nil, errors.New("no node find for the given query") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code branch is not an error condition. In case we reach this, the cursor is not over a function call and we simply return an empty result. Also note, that returning |
||
} | ||
|
||
signature, err := getSignature(call.Func.Name) | ||
if err != nil { | ||
return nil, nil | ||
return nil, err | ||
} | ||
|
||
activeParameter := 0. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
That's incorrect.
See #185 for why.
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 still don't get why we couldn't return an error saying the document is not there. In the point of view of the cache that's an error.
It should be on the side of the caller to decide what to do with it using a sort of switch case on the error.
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.
We shouldn't suppress errors about documents being not there. In fact this error shouldn't have happened in the first place.
The only type of error that should be suppressed is, if the document context has expired, since in that case the request is silently cancelled to avoid returning outdated results to the client.
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.
For explanation: An expired document context means, the document content has changed while processing the request. While that's rare, it shouldn't result in an error. However in that case, an error is raised internally, since the request can't be handled in a sane way. These special errors have to be filtered out, before responding to the client.