pappasam / nginx-language-server

Language server for nginx.conf
GNU General Public License v3.0
66 stars 2 forks source link

[Question] Completion will not work if the file content is empty. #16

Open yaegassy opened 3 years ago

yaegassy commented 3 years ago

Description

One thing is bothering me about nginx-language-server.

The completion doesn't seem to work unless the file has at least "one line" or a string like a;.

Is this the intended behavior?

DEMO

https://user-images.githubusercontent.com/188642/133232734-3822c89f-f6aa-492f-abf6-ec4b9bd4ab80.mp4

pappasam commented 3 years ago

Nope, this is a bug. It has to do with the way context is searched for here: https://github.com/pappasam/nginx-language-server/blob/main/nginx_language_server/server.py#L49

We should probably not return None and instead find a way to assume the ["main"] context or something if no line is found.

yaegassy commented 3 years ago

Thanks reply. I'm glad I reported it.

pappasam commented 3 years ago

@yaegassy just remember this was here. If you find the time to submit a PR, I'll quickly review. Otherwise, I'll get around to fixing this eventually, but it might be a while!