mirror of
https://github.com/godotengine/godot.git
synced 2025-10-25 18:54:43 +00:00
LSP: Account for unicode identifiers
This commit is contained in:
parent
215acd52e8
commit
e213737d66
2 changed files with 20 additions and 9 deletions
|
|
@ -712,9 +712,9 @@ String ExtendGDScriptParser::get_identifier_under_position(const LSP::Position &
|
|||
LSP::Position pos = p_position;
|
||||
if (
|
||||
pos.character >= line.length() // Cursor at end of line.
|
||||
|| (!is_ascii_identifier_char(line[pos.character]) // Not on valid identifier char.
|
||||
|| (!is_unicode_identifier_continue(line[pos.character]) // Not on valid identifier char.
|
||||
&& (pos.character > 0 // Not line start -> there is a prev char.
|
||||
&& is_ascii_identifier_char(line[pos.character - 1]) // Prev is valid identifier char.
|
||||
&& is_unicode_identifier_continue(line[pos.character - 1]) // Prev is valid identifier char.
|
||||
))) {
|
||||
pos.character--;
|
||||
}
|
||||
|
|
@ -723,7 +723,7 @@ String ExtendGDScriptParser::get_identifier_under_position(const LSP::Position &
|
|||
for (int c = pos.character; c >= 0; c--) {
|
||||
start_pos = c;
|
||||
char32_t ch = line[c];
|
||||
bool valid_char = is_ascii_identifier_char(ch);
|
||||
bool valid_char = is_unicode_identifier_continue(ch);
|
||||
if (!valid_char) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -732,13 +732,17 @@ String ExtendGDScriptParser::get_identifier_under_position(const LSP::Position &
|
|||
int end_pos = pos.character;
|
||||
for (int c = pos.character; c < line.length(); c++) {
|
||||
char32_t ch = line[c];
|
||||
bool valid_char = is_ascii_identifier_char(ch);
|
||||
bool valid_char = is_unicode_identifier_continue(ch);
|
||||
if (!valid_char) {
|
||||
break;
|
||||
}
|
||||
end_pos = c;
|
||||
}
|
||||
|
||||
if (!is_unicode_identifier_start(line[start_pos + 1])) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (start_pos < end_pos) {
|
||||
r_range.start.line = r_range.end.line = pos.line;
|
||||
r_range.start.character = start_pos + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue