-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ty] add docstrings to completions based on type #20008
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -421,7 +421,10 @@ impl Workspace { | |||
| .into_iter() | ||||
| .map(|completion| Completion { | ||||
| kind: completion.kind(&self.db).map(CompletionKind::from), | ||||
| name: completion.name.into(), | ||||
| name: completion.inner.name.into(), | ||||
|
Member
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. It would be nice to also hook up documentation in the playground. You have to add a new ruff/playground/ty/src/Editor/Editor.tsx Line 321 in 8c0743d
Contributor
Author
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. I think done? Never tested the playground. |
||||
| documentation: completion | ||||
| .documentation | ||||
| .map(|documentation| documentation.render_plaintext()), | ||||
| }) | ||||
| .collect()) | ||||
| } | ||||
|
|
@@ -908,6 +911,8 @@ pub struct Completion { | |||
| #[wasm_bindgen(getter_with_clone)] | ||||
| pub name: String, | ||||
| pub kind: Option<CompletionKind>, | ||||
| #[wasm_bindgen(getter_with_clone)] | ||||
| pub documentation: Option<String>, | ||||
| } | ||||
|
|
||||
| #[wasm_bindgen] | ||||
|
|
||||
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.
Should we make this a field on
Completioninstead that defaults toNone: Given thatcompletionis the only method constructing the completionsThere 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.
Currently that doesn't work out because Docstring is defined in ty_ide and Completion is defined in ty_python_semantic. The crate boundaries have gotten quite wobbly 😅