-
Notifications
You must be signed in to change notification settings - Fork 268
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
Fix required attributes insertion with first array item #272
Fix required attributes insertion with first array item #272
Conversation
I can't recall \t being used anywhere but I can a look |
there are 12 places where the \t is used in yamlCompletion.ts.
|
Yep, just saw those. Those will need to be switched to use whatever the user has set has their number of spaces in the document |
in this case, isn't the problem that it should be 2 tabs instead of a single one? I think the "array" level is not counted in this specific case. Based on specification, each level can have a different number of spaces https://yaml.org/spec/1.2/spec.html#id2777534 ( :'-( ) will be funny to search for number of spaces on other elements on the same indentation level, when there is one. If not, which defaults? 2 spaces par indentation level? |
fdbe820
to
c3254a7
Compare
redhat-developer/vscode-yaml#312 it occurs only with top-level element Signed-off-by: Aurélien Pupier <[email protected]>
c3254a7
to
e380abf
Compare
the problem occurs only when it is the first element in the document. I updated the PR to provide a a fix and test the 2 cases. @JPinkney I only changed a for usage of tabs, i think this would be nice to handle too but in another tasks (which seems not trivial) |
I was thinking more that if we could find a way to detect what number of spaces the editor was set to use then we could use that, otherwise default to 2. I know that in the lsp tabSize is available for formatting but i'm not sure we can grab that somewhere else and then use that to insert instead of \t but yeah I think this can be done in another PR
I don't remember off the top of my head, that code was added a long time ago in this PR: |
it seems that a
\t
is used instead of 4 spaces. I thought that tabs shouldn't be used in yaml files. To investigate more. @JPinkney does it ring a bell to you?