-
Notifications
You must be signed in to change notification settings - Fork 323
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
Search suggestions by static attribute #6036
Search suggestions by static attribute #6036
Conversation
app/gui/src/controller/searcher.rs
Outdated
@@ -1218,7 +1218,8 @@ impl Searcher { | |||
let requests = return_types_for_engine.into_iter().map(|return_type| { | |||
info!("Requesting suggestions for returnType {return_type:?}."); | |||
let file = graph.module.path().file_path(); | |||
ls.completion(file, &position, &this_type, &return_type, &tags) | |||
let is_static = if this_type.is_some() { Some(false) } else { None }; |
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.
Please put it outside the closure (as I suggested) - there is no need to recompute it for every return_type.
Also, the if
may be replaced with then_some
method: https://doc.rust-lang.org/std/primitive.bool.html#method.then_some
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.
Please describe what is the default value of the isStatic
attribute - otherwise OK.
@@ -177,6 +177,7 @@ trait API { | |||
, self_type : Option<String> | |||
, return_type : Option<String> | |||
, tags : Option<Vec<SuggestionEntryType>> | |||
, is_static : Option<bool> |
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.
Shouldn't the attribute have a default value?
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.
These are the parameters of a search request. If you don't want to specify a parameter, you pass None
@@ -4368,6 +4368,8 @@ Sent from client to the server to receive the autocomplete suggestion. | |||
returnType?: string; | |||
// Filter by the suggestion types | |||
tags?: [SuggestionEntryType]; | |||
// Filter by `static` attribute of the suggestion | |||
isStatic?: Boolean; |
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.
What is the default value when the attribute is missing?
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.
the TypeScript ?
notation in the type definition, i.e.
{
a?: Type;
}
means that the a
attribute is optional and may be null
@@ -76,7 +76,8 @@ object SearchApi { | |||
position: Position, | |||
selfType: Option[String], | |||
returnType: Option[String], | |||
tags: Option[Seq[SuggestionKind]] | |||
tags: Option[Seq[SuggestionKind]], | |||
isStatic: Option[Boolean] |
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.
Can one ask for both - static/instance - methods at once? Or one needs two queries?
Or is it never needed to ask for both types at once?
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.
Can one ask for both - static/instance - methods at once?
If you don't care about the static
attribute, you just pass None
. This way the method will return both static and non-static suggestions.
None, | ||
None, | ||
None, | ||
Some(true) |
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 completeness, would be probably good to have a test that checks non-static methods only
* develop: Layout fixes (#6066) Use new Enso Hash Codes and Comparable (#6060) Search suggestions by static attribute (#6036) Use .node-version for pinning Node.js version (#6057) Fix code generation for suggestion preview (#6054) Implementation of EnsoGL predefined Rectangle shape. (#6033) Tidy up the public module level statics (#6032) Cursor aware Component Browser (#5770)
Pull Request Description
close #5874
Changelog:
isStatic
parameter tosearch/completion
request to search by thestatic
suggestion attributeImportant Notes
Component browser doesn't show
Table.new
andTable.from_rows
suggestions when aTable
node is selected.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.