Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide completion text to insert without tabs, with only space #283

Closed
apupier opened this issue Jul 17, 2020 · 3 comments · Fixed by #315
Closed

Provide completion text to insert without tabs, with only space #283

apupier opened this issue Jul 17, 2020 · 3 comments · Fixed by #315
Assignees

Comments

@apupier
Copy link
Member

apupier commented Jul 17, 2020

tabs are not supported in yaml files.
Some IDEs are converting automatically such as VS Code Yaml but not all, like Eclipse client eclipse-wildwebdeveloper/wildwebdeveloper#478

@apupier apupier changed the title provide completion text to insert without tabs, with only space Provide completion text to insert without tabs, with only space Jul 17, 2020
@apupier
Copy link
Member Author

apupier commented Jul 17, 2020

see #272 (comment) for previous discussion on the subject

@evidolob
Copy link
Collaborator

We may use workspace_configuration workspace/configuration request to get preference value for editor.tabSize. At least it will work for VSCode. For other IDE it will depends on their implementation of workspace_configuration.
Or as alternative we may calculate space or tab for each line or yaml file.
And then use that value for snippet/completion generation.

@evidolob evidolob mentioned this issue Aug 10, 2020
10 tasks
@mickaelistria
Copy link
Contributor

Since the YAML specification explicitly banishes tabs for indent ( https://yaml.org/spec/1.2/spec.html#id2777534 ), it can be seen as a that the LS can produce incorrect yaml by inserting tabs in any case.
The IDE shouldn't have to post-process the LS responses to make the file correct. They may post-process to make it more consistent with X or Y that's specific to the tool, but not to make the file conform to its spec/grammar.
So IMO, it's important to change that in the LS

My suggestion:
If no workspace_configuration is set, the LS should look at the file to infer the number of spaces for indent (looking at the number of spaces before the 1st char of the 2nd line can be one sufficient heuristic). In case the current file is empty, the LS should look in other known yaml files in the folder, in case nothing is available, it should pick the favourite convention of its developers.

@evidolob evidolob self-assigned this Sep 9, 2020
evidolob added a commit to evidolob/yaml-language-server that referenced this issue Sep 11, 2020
evidolob added a commit that referenced this issue Sep 15, 2020
* #283 use space for completion text instead of tab

Signed-off-by: Yevhen Vydolob <[email protected]>

* Add missing 'copied from' comment, remove unused import

Signed-off-by: Yevhen Vydolob <[email protected]>

* Avoid using 'any'

Signed-off-by: Yevhen Vydolob <[email protected]>

* Fix getting indentation

Signed-off-by: Yevhen Vydolob <[email protected]>

* Add changelog

Signed-off-by: Yevhen Vydolob <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants