-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
Basic functionalities for LSP Server #31937
Conversation
abstracted description parsing docs signals, methods and members anchor added docs visal improvements
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 signatureHelper looks ok.
The documentLink should not resolve more than one files.
For documentations of builtin symbols
I'm not sure this is a good way to implement the builtin documentation support.
You dumping the documentaions of builtin symbols to markdown files from the DocData on the server side and display them in the client side. There would be a lot of markdown files in the output folders so we have to manage the versions and make sure they are not deleted by users. That is not so reliable IMO.
I suggest you send documentations in realtime from the server side every time the client request the documentation display (maybe format them to markdown before send). The the client decide how to display the recived data (may caching and open them as markdown file like you did or something else).
You'd better seperate the signatureHelp and documentLink from the markdown documentation code to different PRs.
@@ -75,9 +75,12 @@ class GDScriptWorkspace : public Reference { | |||
|
|||
String get_file_path(const String &p_uri) const; | |||
String get_file_uri(const String &p_path) const; | |||
String simplify_file_uri(const String &p_path) const; |
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.
This method seems only called in get_file_uri
so you can put the implementation inside get_file_uri
String value = lines[i].substr(start_pos + 1, end_pos - start_pos - 1); | ||
|
||
if (!value.begins_with("res://")) { | ||
value = "res://" + 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.
I don't think this is the right way to handle relative file paths.
How about this situation:
res://enermys/wolf.gd
extends 'enermy.gd'
'enermy.gd'
should link to res://enermys/enermy.gd
instead of res://enermy.gd
.
|
||
value = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_uri(value); | ||
// File is not outside project scope && exists | ||
if (value.find(root_uri) != -1 && FileAccess::exists(value.replace(root_uri + "/", "res://"))) { |
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.
Why not call workspace->get_file_path
here ?
|
||
void publish_diagnostics(const String &p_path); | ||
void completion(const lsp::CompletionParams &p_params, List<ScriptCodeCompletionOption> *r_options); | ||
Error get_signature_help(const lsp::TextDocumentPositionParams &p_params, String *r_signature_name, String *r_signature_doc, List<String> *r_signature_parameter, int *r_cur_active_parameter); | ||
Error get_document_link(const lsp::DocumentLinkParams &p_params, List<lsp::DocumentLink> *r_links_parameter); |
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 don't think a path can link to more than one file so why need this function returns multi-values?
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.
Oh I'm wrong.
The LSP require us to return a DocumentLink[]
so we have to search all the strings in scripts.
@@ -1467,7 +1621,7 @@ struct ServerCapabilities { | |||
dict["signatureHelpProvider"] = signatureHelpProvider.to_json(); | |||
dict["codeLensProvider"] = false; // codeLensProvider.to_json(); | |||
dict["documentOnTypeFormattingProvider"] = documentOnTypeFormattingProvider.to_json(); | |||
dict["renameProvider"] = renameProvider.to_json(); | |||
// dict["renameProvider"] = renameProvider.to_json(); |
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.
Do't commit unused code
@@ -1161,6 +1161,267 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri | |||
return OK; | |||
} | |||
|
|||
String DocData::parse_description(String p_description) { |
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 have a more explicit name, like convert_description_to_markdown
.
@@ -284,7 +283,7 @@ void Main::print_help(const char *p_binary) { | |||
#ifdef TOOLS_ENABLED | |||
OS::get_singleton()->print(" --export <target> Export the project using the given export target. Export only main pack if path ends with .pck or .zip.\n"); | |||
OS::get_singleton()->print(" --export-debug <target> Like --export, but use debug template.\n"); | |||
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); | |||
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <bool: inMarkdown> <path> in XML format, merging if existing files are found.\n"); |
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.
This shouldn't change doctool
, just add a new option, e.g. --dump-markdown-docs
.
Commits should be squashed together eventually (with an appropriate description for the squashed commits to describe the overall changes). |
@ankitpriyarup Are you going to continue the work for the signature implementation ? |
No I won't be able to continue |
The documentation part of this PR is superceded by #39359, the rest may still be relevant but I'm not sure. In any case, this PR is not good as-is, since it's still incomplete, has conflicts, and needs squashing. Therefore, I'm closing and adding "salvageable". |
This PR provides functionality for: Function Signature, Markdown documentation & Document Link. I will create another PR later on covering rename functionality very soon.