Merge pull request #69960 from akien-mga/3.x-lsp-fix-root-uri

LSP: Improve handling of file URI scheme
This commit is contained in:
Rémi Verschelde 2022-12-13 14:15:15 +01:00
commit 59ab3626d3
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 6 additions and 4 deletions

View File

@ -183,7 +183,9 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
if (root_uri.length() && is_same_workspace) {
workspace->root_uri = root_uri;
} else {
workspace->root_uri = "file://" + workspace->root;
String r_root = workspace->root;
r_root = r_root.lstrip("/");
workspace->root_uri = "file:///" + r_root;
Dictionary params;
params["path"] = workspace->root;

View File

@ -496,9 +496,9 @@ Error GDScriptWorkspace::parse_local_script(const String &p_path) {
}
String GDScriptWorkspace::get_file_path(const String &p_uri) const {
String path = p_uri;
path = path.replace(root_uri + "/", "res://");
path = path.http_unescape();
String path = p_uri.http_unescape();
String base_uri = root_uri.http_unescape();
path = path.replacen(base_uri + "/", "res://");
return path;
}