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

Error while formatting range for file HTML #48049

Closed
RobertoMalatesta opened this issue Apr 17, 2018 · 16 comments
Closed

Error while formatting range for file HTML #48049

RobertoMalatesta opened this issue Apr 17, 2018 · 16 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues html HTML support issues verified Verification succeeded
Milestone

Comments

@RobertoMalatesta
Copy link

RobertoMalatesta commented Apr 17, 2018

Here's a regression in some latest nightlies, it happens when formatting code. Formatting fails:

[Error - 1:18:06 PM] Error while formatting range for file:///<path edited out by issuer for security>.html: Ovelapping edit
Error: Ovelapping edit
    at Object.applyEdits (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/node_modules/vscode-languageserver-types/lib/umd/main.js:803:27)
    at Object.format (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/modes/formatting.js:75:72)
    at Object.<anonymous> (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:415:64)
    at step (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:36:23)
    at Object.next (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:17:53)
    at fulfilled (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:8:58)
    at <anonymous>
[Error - 1:18:06 PM] Error while formatting range for file:///<path edited out by issuer for security>.html: Ovelapping edit
Error: Ovelapping edit
    at Object.applyEdits (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/node_modules/vscode-languageserver-types/lib/umd/main.js:803:27)
    at Object.format (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/modes/formatting.js:75:72)
    at Object.<anonymous> (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:415:64)
    at step (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:36:23)
    at Object.next (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:17:53)
    at fulfilled (<vscn path edited out for security> /VSCode-linux-x64/resources/app/extensions/html-language-features/server/out/htmlServerMain.js:8:58)
    at <anonymous>
  • VSCode Version:
    code-insider-1.23.0-1523596516_amd64.tar.gz
    code-insider-1.23.0-1523942099_amd64.tar.gz

  • Platform
    Ubuntu 14.04 but I bet it's irrelevant.

-R

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Apr 17, 2018

  • Does this occur when you run code with extensions disabled as well? Run code --disable-extensions to try it out.
  • Can you provide sample code where you see this along with edits made to the file after which this occurs?
  • Does this occur in the stable version as well?
  • Does this occur when you run formatting manually or you are using the format on save / format on type features?

@ramya-rao-a ramya-rao-a added html HTML support issues formatting Source formatter issues labels Apr 17, 2018
@ramya-rao-a ramya-rao-a added the info-needed Issue requires more information from poster label Apr 17, 2018
@RobertoMalatesta
Copy link
Author

Hi @ramya-rao-a and thanks for your caring:

Does this occur when you run code with extensions disabled as well? Run code --disable-extensions to try it out.

Yes

Can you provide sample code where you see this along with edits made to the file after which this occurs?

No. But the same page formatted properly on some nightly older than a week ago (no change)

Does this occur in the stable version as well?

stable is OK.

Does this occur when you run formatting manually or you are using the format on save / format on type features?

Both.

I hope of having been helpful. I will investigate further as soon as I have more time.

--R

@ramya-rao-a
Copy link
Contributor

Having a sample code where we can see the issue will help a lot.

@RobertoMalatesta
Copy link
Author

I'll set up an example project as soon as I have time.
Thanks for caring.

--R

@RobertoMalatesta
Copy link
Author

<html>
<head>
</head>

<body>

    <script>
        function f(x) {}
        f(function () {
        // 
   
        console.log(" vsc crashes on formatting")
        });
    </script>



        </body>

</html>

@RobertoMalatesta
Copy link
Author

RobertoMalatesta commented Apr 25, 2018

@ramya-rao-a here it is!
(I tried to restrict the issue a bit)
It's rather weird.
Fails formatting on the following nightlies:

code-insider-1.23.0-1523510016_amd64.tar.gz
code-insider-1.23.0-1523596516_amd64.tar.gz
code-insider-1.23.0-1523942099_amd64.tar.gz
code-insider-1.23.0-1524028477_amd64.tar.gz
code-insider-1.23.0-1524201267_amd64.tar.gz
code-insider-1.23.0-1524633233_amd64.tar.gz

@ramya-rao-a
Copy link
Contributor

Thanks @RobertoMalatesta
I can repro this both in stable and Insiders

@ramya-rao-a ramya-rao-a removed the info-needed Issue requires more information from poster label Apr 25, 2018
@jrieken jrieken removed their assignment Apr 26, 2018
aeschli added a commit that referenced this issue May 2, 2018
@aeschli
Copy link
Contributor

aeschli commented May 2, 2018

@RobertoMalatesta @ramya-rao-a Thanks a lot for taking your time. Strangely I'm not able to reproduce. I even created a test case for it.
I also tried with code-insider-1.23.0-1524633233_amd64.tar.gz (on Ubuntu 16.04)

Do you have any html, javascript or indentation settings defined?

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented May 2, 2018

@aeschli I dont have any such settings and can repro this even with all extensions disabled.

I was able to find the root cause in the compare function passed to mergeSort when applying the edits.
See

https://github.com/Microsoft/vscode-languageserver-node/blob/4c66383e92a2f7d513f93e5ecc74b21b4889d3a5/types/src/main.ts#L1602

We should be returning diff there not 0

@RobertoMalatesta
Copy link
Author

RobertoMalatesta commented May 3, 2018

Do you have any html, javascript or indentation settings defined?

No. A clean one with no extensions.

@aeschli
Copy link
Contributor

aeschli commented May 3, 2018

@ramya-rao-a Good catch, thanks!

@aeschli
Copy link
Contributor

aeschli commented May 3, 2018

Fixed pushed to vscode-languageserver-node.

@aeschli aeschli reopened this May 3, 2018
@aeschli
Copy link
Contributor

aeschli commented May 3, 2018

it will take a while until we get the fix in VSCode...

@RobertoMalatesta
Copy link
Author

Thanks @ramya-rao-a and @aeschli .
Unbeatable support.
Now I'll try to break some other thing... :P

@ramya-rao-a ramya-rao-a added the bug Issue identified by VS Code Team member as probable bug label May 4, 2018
@aeschli
Copy link
Contributor

aeschli commented May 28, 2018

Fix is now in VSCode insiders

@aeschli aeschli closed this as completed May 28, 2018
@RobertoMalatesta
Copy link
Author

🆗

@aeschli aeschli added the verified Verification succeeded label May 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues html HTML support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants