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

Overlapping functionality with the VSCode YAML extension #230

Open
paidhi opened this issue Apr 29, 2019 · 10 comments
Open

Overlapping functionality with the VSCode YAML extension #230

paidhi opened this issue Apr 29, 2019 · 10 comments

Comments

@paidhi
Copy link

paidhi commented Apr 29, 2019

Environment

  • Extension version: 0.5.2
  • OS Type: Windows

Summary

The functionality of this extension seems to overlap with the YAML extension (redhat.vscode-yaml). Both extensions populate the Outline view as well as Go to symbol. So all elements are displayed twice.
This is not really a bug but keeps irritating me when working with Ansible and YAML files.

Reproduce steps

Install both this extension and redhat.vscode-yaml. Open a YAML file and see duplicate entries in the Outline view and Go to symbol.

@paidhi
Copy link
Author

paidhi commented Apr 29, 2019

I have reported this in parallel here: redhat-developer/vscode-yaml#178

@paidhi
Copy link
Author

paidhi commented Apr 29, 2019

The duplicate entries only show if the selected language mode for the file is yaml. If set to ansible it's fine.

@abohne
Copy link

abohne commented Dec 3, 2019

This also breaks settings for the YAML extension.

E.g. in settings.json

"yaml.customTags": [
        "!And",
        "!If",
        "!Not",
        "!Equals",
        "!Or",
        "!FindInMap sequence",
        "!Base64",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Select sequence",
        "!Split",
        "!Join sequence",
        "!FindInMap",
        "!Join",
        "!And sequence",
        "!If sequence",
        "!Not sequence",
        "!Equals sequence",
        "!Or sequence",
        "!Sub sequence",
        "!ImportValue sequence",
        "!Split sequence"
    ],

If I open a YAML file that uses those tags, VS Code will tell me the tags are invalid

unknown tag <!Sub>
unknown tag <!FindInMap>

The only way to work around this is to disable the ansible extension and reload vs code.

@abohne
Copy link

abohne commented Dec 3, 2019

Here's a better workaround:

Edit package.json in your local copy of the extension:
Remove "onLanguage:yaml" from activationEvents

IMO, the maintainers should make this modification instead of broadly taking over the YAML filetype.

@darrenswart
Copy link

When you say "edit package.json in your local copy of the extension" I'm assuming you mean more than just editing the package.json file for the installed extension. I'm assuming I need to make a copy of the extension, edit package.json and then install my edited version. Could you explain how to accomplish what you have suggested

@abohne
Copy link

abohne commented Jan 7, 2020

When you say "edit package.json in your local copy of the extension" I'm assuming you mean more than just editing the package.json file for the installed extension. I'm assuming I need to make a copy of the extension, edit package.json and then install my edited version. Could you explain how to accomplish what you have suggested

You need to remove this line from the installed copy of the extension:

"onLanguage:yaml",

On my laptop, this was located in ~/.vscode/extensions/vscoss.vscode-ansible-0.5.2/package.json. I assume this change will need to be made next time the extension is updated, but it works for now.

@darrenswart
Copy link

When you say "edit package.json in your local copy of the extension" I'm assuming you mean more than just editing the package.json file for the installed extension. I'm assuming I need to make a copy of the extension, edit package.json and then install my edited version. Could you explain how to accomplish what you have suggested

You need to remove this line from the installed copy of the extension:

"onLanguage:yaml",

On my laptop, this was located in ~/.vscode/extensions/vscoss.vscode-ansible-0.5.2/package.json. I assume this change will need to be made next time the extension is updated, but it works for now.

Thanks abohne! For anyone else interested in this workaround after making the change I had to disable/enable the extension. Restarting vscode wasn't enough. This also solves the problem of ansible intellisense running on yaml files that aren't ansible files.

@ssbarnea
Copy link

Considering that the current behavior if this extension breaks almost all other YAML using extensions by overriding user configuration "yaml.customTags" this would be a good enough reason to de-list this extension until this bug is addressed.

I am really annoyed amount of time wasted trying to debug an issue. I think is more than obvious that an extension related to Ansible, should not mess any YAML file. Unless the file-type is marked as Ansible, this extension should not interfere with them.

I know that bug happen, but this bug was reported almost one year ago and this extension still breaks other YAML extensions, which I do not find acceptable.

@wholroyd
Copy link

wholroyd commented Jan 19, 2020

Considering that the current behavior if this extension breaks almost all other YAML using extensions by overriding user configuration "yaml.customTags" this would be a good enough reason to de-list this extension until this bug is addressed.

I am really annoyed amount of time wasted trying to debug an issue. I think is more than obvious that an extension related to Ansible, should not mess any YAML file. Unless the file-type is marked as Ansible, this extension should not interfere with them.

I know that bug happen, but this bug was reported almost one year ago and this extension still breaks other YAML extensions, which I do not find acceptable.

One thing to keep in mind is that this wasn't always the behavior for extensions that are trying to tie multiple languages together. It used to work differently about 2-3 years ago where issues like this wouldn't have been a problem. Issues exist for it in the VScode project, but have not been resolved or prioritized.

I have tried to develop the same functionality that this extension provides (pre-exists this one in fact), but unfortunately there is not a lot of great control that the extension editors have over the editor's language behaviors. Especially the built-in languages as those are treated differently by the editor than community ones.

@somq
Copy link

somq commented Sep 23, 2020

Simple workaround, disable the extension at workspace level ( "ansible.autocompletion": false):

.vscode/settings.json

{
  "ansible.autocompletion": false,
  "serverlessIDE.completion": true,
  "yaml.customTags": [
    "!Equals sequence",
    "!FindInMap sequence",
    "!GetAtt",
    "!GetAtt sequence",
    "!GetAZs",
    "!ImportValue",
    "!Join sequence",
    "!Ref",
    "!Ref sequence",
    "!Select sequence",
    "!Split sequence",
    "!Sub",
    "!Base64 mapping",
    "!And",
    "!And sequence",
    "!If",
    "!If sequence",
    "!Not",
    "!Not sequence",
    "!Equals",
    "!Or",
    "!Or sequence",
    "!FindInMap",
    "!Base64",
    "!Join",
    "!Cidr",
    "!Sub sequence",
    "!ImportValue sequence",
    "!Select",
    "!Split"
  ],
}

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

No branches or pull requests

6 participants