withastro / language-tools

Language tools for Astro
MIT License
258 stars 50 forks source link

🐛 BUG: Neovim broken lsp on dynamic routes #802

Closed aaronjconway closed 3 months ago

aaronjconway commented 6 months ago

Describe the Bug

Currently when using dynamic [anything].astro routes I am having issues in neovim. No issues on other .astro files.

I get minimal lsp support but html, css and most ts not working.

Some but not all diagnostics work.

Formatting is either non existent or sometimes breaks on save. If I delete a line and save, it adds the line back.

vscode has no issues.

Thank you!!

Steps to Reproduce

I have a minimal neovim config at https://github.com/aaronjconway/astro_config

Steps to reproduce

  1. Init basic Astro with typescript
npm create astro@latest

Empty: yes
Typescript: yes - strict
  1. Add prettier and prettier-plugin-astro
npm i -D prettier prettier-plugin-astro
  1. Add the recommend .prettierrc.mjs found here: https://github.com/withastro/prettier-plugin-astro

// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
  plugins: ['prettier-plugin-astro'],
  overrides: [
    {
      files: '*.astro',
      options: {
        parser: 'astro',
      },
    },
  ],
}
  1. make a [page].astro file test lsp in new astro file and no lsp