mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
js: Allow for completion of lexically declared variables
This does require us to have a method which lists all the bindings in a declarative environment which is not in the spec.
This commit is contained in:
parent
0be0e7ea6e
commit
f4f1397735
3 changed files with 18 additions and 0 deletions
|
@ -1361,6 +1361,12 @@ int main(int argc, char** argv)
|
|||
case CompleteVariable: {
|
||||
auto const& variable = interpreter->global_object();
|
||||
list_all_properties(variable.shape(), variable_name);
|
||||
|
||||
for (String& name : global_environment.declarative_record().bindings()) {
|
||||
if (name.starts_with(variable_name))
|
||||
results.empend(name);
|
||||
}
|
||||
|
||||
if (results.size())
|
||||
editor.suggest(variable_name.length());
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue