kartikvashistha / zed-ansible

Ansible LSP Extension for the Zed editor
MIT License
1 stars 0 forks source link

Share your lsp configuration #4

Open SudarshanVK opened 1 week ago

SudarshanVK commented 1 week ago

Hi All,

This is not an Issue, but for someone who does not have much experience with tree-sitter and lsp, are you guys able to share your configuration settings?

I am trying to make a move from VScode to Zed. The things I am struggling with are the syntax highlighting, eg: with the Ansible plugin in VSCode, the task names and variables are highlighted in a different color and it makes it more readable.

I am also affected by the memory leak issue and have currently disabled the plugin to continue to use Zed but keeping a close watch on the issue being tracked here.

kartikvashistha commented 4 days ago

Hey @SudarshanVK , currently for me, the settings as listed in the project's README work just fine. Here's how my Zed extension config file looks like for detecting Ansible files and configuring the LSP:

{
  ...,
  "file_types": {
    "Ansible": [
      "**.ansible.yml",
      "**/defaults/**.yml",
      "**/defaults/**.yaml",
      "**/meta/**.yml",
      "**/meta/**.yaml",
      "**/tasks/**.yml",
      "**/tasks/*.yml",
      "**/tasks/*.yaml",
      "**/handlers/*.yml",
      "**/handlers/*.yaml",
      "**/group_vars/**.yml",
      "**/group_vars/**.yaml",
      "**playbook*.yaml",
      "**playbook*.yml"
    ]
  },
  "lsp": {
    "ansible-language-server": {
      "settings": {
        "ansible": {
          "path": "ansible"
        },
        "executionEnvironment": {
          "enabled": false
        },
        "python": {
          "interpreterPath": "python3"
        },
        "validation": {
          "enabled": true,
          "lint": {
            "enabled": false,
            "path": "ansible-lint"
          }
        }
      }
    }
  }
}

The things I am struggling with are the syntax highlighting, eg: with the Ansible plugin in VSCode, the task names and variables are highlighted in a different color and it makes it more readable.

Ha, you and me both! So that additional colour highlighting is provided courtesy of the LSP server via something called semantic tokens. Unfortunately, Zed doesn't support this at the moment.

Feel free to track this in the following issue to know when it's rolled out: https://github.com/zed-industries/zed/issues/7450

SudarshanVK commented 3 days ago

Hey Kartik, Thank you for sharing your config. Now can I get ansible lint showing me errors in the editor? is that even possible in Zed?

kartikvashistha commented 2 days ago

Yes, absolutely - you can see the ansible lint errors under diagnostics and as red squigly lines in the editor:

Screenshot 2024-10-15 at 20 14 49

Feel free to install and play around with the extension - fyi, I have just pushed a new update that has temporarily disabled highlighting (till we can fix it), so you should be able to at least play around with the LSP without the extension crashing your computer.