mirror of
https://github.com/godotengine/godot.git
synced 2025-10-21 08:53:35 +00:00
LSP: Fix file URI handling + warn about workspace project mismatch
This commit is contained in:
parent
019ab8745f
commit
d55883b4b1
7 changed files with 170 additions and 18 deletions
|
@ -171,6 +171,28 @@ void GDScriptLanguageProtocol::_bind_methods() {
|
|||
Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
|
||||
LSP::InitializeResult ret;
|
||||
|
||||
{
|
||||
// Warn if the workspace root does not match with the project that is currently open in Godot,
|
||||
// since it might lead to unexpected behavior, like wrong warnings about duplicate class names.
|
||||
|
||||
String root;
|
||||
Variant root_uri_var = p_params["rootUri"];
|
||||
Variant root_var = p_params["rootPath"];
|
||||
if (root_uri_var.is_string()) {
|
||||
root = get_workspace()->get_file_path(root_uri_var);
|
||||
} else if (root_var.is_string()) {
|
||||
root = root_var;
|
||||
}
|
||||
|
||||
if (ProjectSettings::get_singleton()->localize_path(root) != "res://") {
|
||||
LSP::ShowMessageParams params{
|
||||
LSP::MessageType::Warning,
|
||||
"The GDScript Language Server might not work correctly with other projects than the one opened in Godot."
|
||||
};
|
||||
notify_client("window/showMessage", params.to_json());
|
||||
}
|
||||
}
|
||||
|
||||
String root_uri = p_params["rootUri"];
|
||||
String root = p_params["rootPath"];
|
||||
bool is_same_workspace;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue