Skip to content

Commit

Permalink
LSP: Improve handling of file URI scheme
Browse files Browse the repository at this point in the history
Fixes #63205.

(cherry picked from commits 3fa943f,
42a16ef and
2ff69d6)
  • Loading branch information
A-Lamia authored and akien-mga committed Dec 12, 2022
1 parent 3a2f2d9 commit a412922
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions modules/gdscript/language_server/gdscript_workspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a412922

Please sign in to comment.