FractalBoy / perl-language-server

101 stars 12 forks source link

Support completion for keys of a hash table #174

Open gzqx opened 7 months ago

gzqx commented 7 months ago

Thank you for this wonderful project. I enjoy using it for quite some time.

However, I noticed that it seems to lack the ability to do semantic completion for:

If I have a hash table

%b={
    "apple"=>"good",
    "orange"=> "bad",
}
$a=\%b

It seems that it cannot auto-complete for neither $a->{ nor %b{, which IMHO is possible and would be really helpful.

I have not fully checked the document and code, so if the feature is already included I sincerely apologize in advance.

FractalBoy commented 7 months ago

This is difficult to do for the same reason it's difficult to know what methods are available on a variable.

We could collect all hash keys found in the document and offer those for auto complete but it's impossible to know what the keys are across files.