microsoft / azure-pipelines-language-server

A language server for Azure Pipelines YAML
37 stars 25 forks source link

Using auto-complete to fix a typo in "property" breaks structure #113

Closed ghost closed 2 years ago

ghost commented 2 years ago

We have quite old bug about auto-completion that breaks structure: https://github.com/microsoft/azure-pipelines-vscode/issues/176 It happens in cases when we use auto-completion for properties, because function getInsertTextForProperty always adds colon for result text for auto-completion.

Description of the fix: Check if node, that should be completed, already contains colon, and increase length of section that should be replaced I've tested these changes on VSCode azure-pipelines extension: ran it locally and tried to work on some yaml doc, using different types of node and requested auto-completion from different places - everything looks fine

The previous behavior: Animation2

The new behavior: Animation

50Wliu commented 2 years ago

Could a test also be added for this? https://github.com/microsoft/azure-pipelines-language-server/blob/main/language-service/test/pipelinesTests/yamlcompletion.test.ts

ghost commented 2 years ago

Could a test also be added for this? https://github.com/microsoft/azure-pipelines-language-server/blob/main/language-service/test/pipelinesTests/yamlcompletion.test.ts

I have added a test.

ghost commented 2 years ago

Hi @50Wliu, could you please merge this PR?