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

Formatting issue on 0.40.8 and 0.40.9 #1832

Closed
sevillaarvin opened this issue Sep 6, 2022 · 2 comments
Closed

Formatting issue on 0.40.8 and 0.40.9 #1832

sevillaarvin opened this issue Sep 6, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@sevillaarvin
Copy link

Hello, I'm using @volar/vue-language-server with emacs/eglot and I encounted a bug with the textDocument/formatting method.

I have a simple test.vue page with bare bones tags. When I request a format, the server's reply removes essential characters that have no syntax errors.

This happens only in 0.40.8 and 0.40.9, not in 0.40.7.

Any advice is appreciated, thanks!

test.vue before format
<script setup>
asdf
</script>

<template>
</template>

<style scoped>
</style>
test.vue after format
<script setup>
asdf
t >

  <template>
e>

    <style scoped>
    </style>
jsonrpc client-server logs
[client-request] (id:31) Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :id 31 :method "textDocument/formatting" :params
          (:textDocument
           (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue")
           :options
           (:tabSize 2 :insertSpaces t :insertFinalNewline t :trimFinalNewlines t)))
[server-reply] (id:31) Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :id 31 :result
          [(:range
            (:start
             (:line 0 :character 0)
             :end
             (:line 10 :character 0))
            :newText "<script setup>\nasdf\nt >\n\n  <template>\ne>\n\n    <style scoped>\n    </style>\n\n")])
[client-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
          (:textDocument
           (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :version 128)
           :contentChanges
           [(:range
             (:start
              (:line 0 :character 0)
              :end
              (:line 10 :character 0))
             :rangeLength 80 :text "<script setup>\nasdf\nt >\n\n  <template>\ne>\n\n    <style scoped>\n    </style>\n\n")]))
[client-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/didSave" :params
          (:text "<script setup>\nasdf\nt >\n\n  <template>\ne>\n\n    <style scoped>\n    </style>\n\n" :textDocument
                 (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue")))
[server-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
          (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :diagnostics
                []
                :version 128))
[server-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
          (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :diagnostics
                [(:range
                  (:start
                   (:line 4 :character 3)
                   :end
                   (:line 4 :character 11))
                  :severity 1 :source "ts" :code 17008 :message "JSX element 'template' has no corresponding closing tag." :data
                  (:version 128))
                 (:range
                  (:start
                   (:line 5 :character 1)
                   :end
                   (:line 5 :character 2))
                  :severity 1 :source "ts" :code 1382 :message "Unexpected token. Did you mean `{'>'}` or `&gt;`?" :data
                  (:version 128))]
                :version 128))
[server-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
          (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :diagnostics
                [(:range
                  (:start
                   (:line 4 :character 3)
                   :end
                   (:line 4 :character 11))
                  :severity 1 :source "ts" :code 17008 :message "JSX element 'template' has no corresponding closing tag." :data
                  (:version 128))
                 (:range
                  (:start
                   (:line 5 :character 1)
                   :end
                   (:line 5 :character 2))
                  :severity 1 :source "ts" :code 1382 :message "Unexpected token. Did you mean `{'>'}` or `&gt;`?" :data
                  (:version 128))]
                :version 128))
[server-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
          (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :diagnostics
                [(:range
                  (:start
                   (:line 4 :character 3)
                   :end
                   (:line 4 :character 11))
                  :severity 1 :source "ts" :code 17008 :message "JSX element 'template' has no corresponding closing tag." :data
                  (:version 128))
                 (:range
                  (:start
                   (:line 5 :character 1)
                   :end
                   (:line 5 :character 2))
                  :severity 1 :source "ts" :code 1382 :message "Unexpected token. Did you mean `{'>'}` or `&gt;`?" :data
                  (:version 128))]
                :version 128))
[server-notification] Wed Sep  7 00:19:46 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
          (:uri "file:///Users/$USER/projects/$PROJECT/pages/test.vue" :diagnostics
                [(:range
                  (:start
                   (:line 4 :character 3)
                   :end
                   (:line 4 :character 11))
                  :severity 1 :source "ts" :code 17008 :message "JSX element 'template' has no corresponding closing tag." :data
                  (:version 128))
                 (:range
                  (:start
                   (:line 5 :character 1)
                   :end
                   (:line 5 :character 2))
                  :severity 1 :source "ts" :code 1382 :message "Unexpected token. Did you mean `{'>'}` or `&gt;`?" :data
                  (:version 128))]
                :version 128))
@johnsoncodehk
Copy link
Member

Thanks for the report! It should be fixed by 88864c3.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Sep 6, 2022
@sevillaarvin
Copy link
Author

Got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants