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

Formatter not functioning as expected in latest version (extensions-108.0.0) #2210

Closed
yassinrais opened this issue Nov 22, 2023 · 11 comments
Closed
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@yassinrais
Copy link

yassinrais commented Nov 22, 2023

Describe the bug

The formatter in vscode no longer works

Reproduction

Using the latest version

https://github.com/sveltejs/language-tools/releases/tag/extensions-108.0.0

Expected behaviour

formatting should works

System Info

  • OS: Mac
  • IDE: VScode

Which package is the issue about?

https://github.com/sveltejs/language-tools/releases/tag/extensions-108.0.0

Additional Information, eg. Screenshots

No response

@yassinrais yassinrais added the bug Something isn't working label Nov 22, 2023
@dummdidumm
Copy link
Member

svelte-check isn't used for formatting.
Please provide a reproduction repository so we can properly investigate this.

@yassinrais yassinrais changed the title Formatter not functioning as expected in latest version (svelte-check-3.6.1) Formatter not functioning as expected in latest version (extensions-108.0.0) Nov 22, 2023
@yassinrais
Copy link
Author

My bad it was the wrong release tag 😄

The version that no longer works is this one (the most recent):
https://github.com/sveltejs/language-tools/releases/tag/extensions-108.0.0

Reproduction:
I have a basic svelte component file, and when I switch to the latest version 108.0.0 there's no formatting, but when I switch back to the previous version it works and the file is formatted like always.

@yassinrais
Copy link
Author

yassinrais commented Nov 22, 2023

{
    "type": "Script",
    "start": 0,
    "end": 14003,
    "context": "default",
    "content": {
        "type": "Program",
        "start": 13992,
        "end": 13994,
        "loc": {
            "start": {
                "line": 1,
                "column": 0
            },
            "end": {
                "line": 1,
                "column": 13994
            }
        },
        "body": [
            {
                "type": "BlockStatement",
                "start": 13992,
                "end": 13994,
                "loc": {
                    "start": {
                        "line": 1,
                        "column": 13992
                    },
                    "end": {
                        "line": 1,
                        "column": 13994
                    }
                },
                "body": []
            }
        ],
        "sourceType": "module"
    }
}
Error: unknown node type: Script
    at Object.print (/Users/username/.vscode/extensions/svelte.svelte-vscode-108.0.0/node_modules/prettier-plugin-svelte/plugin.js:1450:11)
    at callPluginPrintFunction (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8601:26)
    at mainPrintInternal (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8550:22)
    at mainPrint (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8537:18)
    at AstPath.call (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8359:24)
    at printTopLevelParts (/Users/username/.vscode/extensions/svelte.svelte-vscode-108.0.0/node_modules/prettier-plugin-svelte/plugin.js:1491:33)
    at Object.print (/Users/username/.vscode/extensions/svelte.svelte-vscode-108.0.0/node_modules/prettier-plugin-svelte/plugin.js:901:16)
    at callPluginPrintFunction (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8601:26)
    at mainPrintInternal (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8550:22)
    at mainPrint (/Users/username/Documents/Project/svelte-project/node_modules/prettier/index.js:8537:18)

@yassinrais
Copy link
Author

<script lang="ts">
// ... some basic code
</script>

<div>
  <!-- basic html -->
</div>

<style lang="scss">
// some basic style here
</style>

@dummdidumm
Copy link
Member

I can't reproduce this. Please provide a github repository that reproduces this issue.

@yadoga
Copy link

yadoga commented Nov 23, 2023

Experiencing the same bug since yesterday (latest release). Just opened a very basic empty .svelte file. Auto-formatting does currently not work.

Reverting to v107.13.0 and auto-formatting works

@dummdidumm
Copy link
Member

Can someone please provide an actual reproduction instead of just saying it doesn't work? As I said I can't reproduce this.

It has to do with the bump to using prettier version 3 by default now, I'm pretty sure about that, but I need a reproducible to get to the bottom of this

@yassinrais
Copy link
Author

im working on it :) sorry for late

@yassinrais
Copy link
Author

yassinrais commented Nov 23, 2023

@triskel78
Copy link

@yassinrais if it helps you : I had the same issue with prettier version 2, updating to version 3 solved the problem

dummdidumm added a commit that referenced this issue Nov 23, 2023
needs to check for version 3 or higher now
#2210
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Nov 23, 2023
@dummdidumm
Copy link
Member

Should be fixed in the latest version of the VS Code extension

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

No branches or pull requests

4 participants