autocomplete for $" and $'
This commit is contained in:
parent
61b41d6001
commit
17166f5640
1 changed files with 11 additions and 0 deletions
|
@ -5718,6 +5718,7 @@ void TextEdit::_update_completion_candidates() {
|
||||||
|
|
||||||
bool inquote = false;
|
bool inquote = false;
|
||||||
int first_quote = -1;
|
int first_quote = -1;
|
||||||
|
int restore_quotes = -1;
|
||||||
|
|
||||||
int c = cofs - 1;
|
int c = cofs - 1;
|
||||||
while (c >= 0) {
|
while (c >= 0) {
|
||||||
|
@ -5725,6 +5726,11 @@ void TextEdit::_update_completion_candidates() {
|
||||||
inquote = !inquote;
|
inquote = !inquote;
|
||||||
if (first_quote == -1)
|
if (first_quote == -1)
|
||||||
first_quote = c;
|
first_quote = c;
|
||||||
|
restore_quotes = 0;
|
||||||
|
} else if (restore_quotes == 0 && l[c] == '$') {
|
||||||
|
restore_quotes = 1;
|
||||||
|
} else if (restore_quotes == 0 && !_is_whitespace(l[c])) {
|
||||||
|
restore_quotes = -1;
|
||||||
}
|
}
|
||||||
c--;
|
c--;
|
||||||
}
|
}
|
||||||
|
@ -5792,6 +5798,11 @@ void TextEdit::_update_completion_candidates() {
|
||||||
completion_strings.write[i] = completion_strings[i].unquote().quote("'");
|
completion_strings.write[i] = completion_strings[i].unquote().quote("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inquote && restore_quotes == 1 && !completion_strings[i].is_quoted()) {
|
||||||
|
String quote = single_quote ? "'" : "\"";
|
||||||
|
completion_strings.write[i] = completion_strings[i].quote(quote);
|
||||||
|
}
|
||||||
|
|
||||||
if (completion_strings[i].begins_with(s)) {
|
if (completion_strings[i].begins_with(s)) {
|
||||||
completion_options.push_back(completion_strings[i]);
|
completion_options.push_back(completion_strings[i]);
|
||||||
} else if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
|
} else if (completion_strings[i].to_lower().begins_with(s.to_lower())) {
|
||||||
|
|
Loading…
Reference in a new issue