Skip to content

Commit 27cc051

Browse files
committed
Merge pull request godotengine#105059 from HolonProduction/lsp-relative
LSP: Fix relative path handling for document links
2 parents 742d91b + 920997d commit 27cc051

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/gdscript/language_server/gdscript_extend_parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ void ExtendGDScriptParser::update_document_links(const String &p_code) {
208208
const Variant &const_val = token.literal;
209209
if (const_val.get_type() == Variant::STRING) {
210210
String scr_path = const_val;
211-
bool exists = fs->file_exists(scr_path);
212-
if (!exists) {
213-
scr_path = get_path().get_base_dir() + "/" + scr_path;
214-
exists = fs->file_exists(scr_path);
211+
if (scr_path.is_relative_path()) {
212+
scr_path = get_path().get_base_dir().path_join(scr_path).simplify_path();
215213
}
214+
bool exists = fs->file_exists(scr_path);
215+
216216
if (exists) {
217217
String value = const_val;
218218
LSP::DocumentLink link;

0 commit comments

Comments
 (0)