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

Whole buffer replaced with syntax error #84

Closed
baelter opened this issue Feb 7, 2019 · 15 comments
Closed

Whole buffer replaced with syntax error #84

baelter opened this issue Feb 7, 2019 · 15 comments
Labels

Comments

@baelter
Copy link

baelter commented Feb 7, 2019

In this installation:

code --version
1.31.0
7c66f58312b48ed8ca4e387ebd9ffe9605332caa
x64
crystal-lang: 0.3.12

The entire buffer is replaced with any syntax error.

E.g.

my_method(
Syntax error in line 1: expecting token ')', not 'end'
@faustinoaq faustinoaq added the bug label Feb 8, 2019
@faustinoaq
Copy link
Member

Oh, I can confirm this bug, Thank you for report it 👍

@baelter
Copy link
Author

baelter commented Feb 28, 2019

Still happens in 0.3.14 in rare cases with missing end. Could not boil it down to a minimal example though :/

@faustinoaq
Copy link
Member

Still happens in 0.3.14 in rare cases with missing end. Could not boil it down to a minimal example though :/

yeah, This still happens when crystal tool format throws another message like a bug report or similar. I'm working on a new backend for this extension, with new features and less bugs. I hope to get it soon 👍

@faustinoaq faustinoaq reopened this Mar 9, 2019
@bcardiff
Copy link
Member

I also experienced this and was worried if it was on the formatter side or in the extension.

Also, when using a custom crystal build the first line in the buffer ends up being: Using compiled compiler at .build/crystal. Maybe is something to have in mind during the refactor. :-)

@faustinoaq
Copy link
Member

Hi @bcardiff

Thank you for your comment.

Yeah, current Node.js backend has some pitfalls, currently I'm using experimental Scry server while working on a new backend for this extension, I need to sync my work with github, though 😅

I'm using this branch https://github.com/crystal-lang-tools/scry/tree/fa/work-in-progress

Also here is my currently working source code of scry:

scry.zip

SHA256: f8556f4b2816ecbb6c1e31c24b3740a91d055d3f9426b80310509c52de5bedb7

There is a bin/linux compatible with 64 bit linux systems, with the following linked libraries:

[main@pc bin]$ pwd
/home/main/Projects/scry/bin
[main@pc bin]$ ldd scry 
        linux-vdso.so.1 (0x00007ffd71ce3000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fd14e6c3000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fd14e53e000)
        libgc.so.1 => /usr/lib/libgc.so.1 (0x00007fd14e4d2000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd14e4b1000)
        libevent-2.1.so.6 => /usr/lib/libevent-2.1.so.6 (0x00007fd14e459000)
        librt.so.1 => /usr/lib/librt.so.1 (0x00007fd14e44f000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd14e448000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fd14e42e000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fd14e26a000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fd14ec12000)
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fd14df96000)

ezgif-3-8c99d4f1095f

My settings.json is:

{
    "crystal-lang.server": "/home/main/Projects/scry/bin/linux"
}

@faustinoaq
Copy link
Member

faustinoaq commented Apr 3, 2019

Formatting feature inside Scry should work like a charm, 'cause it doesn't uses command line, so no warning messages or other formatting errors can be included in formatted code.

https://github.com/crystal-lang-tools/scry/blob/6a8ff983b0cb140b90be4f9992c007a3b86715a8/src/scry/formatter.cr#L16-L32

@rowland
Copy link

rowland commented Jul 4, 2019

This one keeps biting me. It's rather unnerving.

@bcardiff
Copy link
Member

@faustinoaq Is there any progress in the scry server that can be published? Otherwise, it would be great to consider fixing this issue in the latest version since it's a papercut that many people with the constant-saving-file-behavior ✋will suffer.

I know little or nothing about developing vscode extensions. I'm not sure after a checkout which node/ts should be installed and how to run the working copy version of the extension. If you can point me on these topics I might be able to hack around.

Thanks!

@paulcsmith
Copy link

I just placed a $50 bounty to help out with this issue. Would love to have it fixed if we can :D

https://www.bountysource.com/issues/69775273-whole-buffer-replaced-with-syntax-error

@girng
Copy link

girng commented Oct 21, 2019

LOL the first time this happened, my heart dropped. I was so happy ctrl+z worked, I think I would have cried :D. But yeah, this bug actually played a vital role in me creating backups. Which in the end, is a positive thing. Happy little bugs

@jgillich
Copy link

@faustinoaq Thoughts on #99? Can we get this in?

@jgillich
Copy link

In the meantime, I've published a fork with the fix from #99:

https://marketplace.visualstudio.com/items?itemName=jgillich.crystal-lang-fixed

RX14 added a commit that referenced this issue Mar 20, 2020
Fixed problems with formatting the code with errors #84
@faustinoaq
Copy link
Member

Hi @jgillich @baelter @rowland @paulcsmith @girng @bcardiff vscode-crystal-lang is updated now.

I can confirm, this error doesn't happen anymore, feel free to test it and report new issues 😄

image

image

@RX14 RX14 closed this as completed Mar 31, 2020
@RockManJoe64
Copy link

RockManJoe64 commented Aug 5, 2020

Awesome work! Will this fix make it into the main fork of the Crystal plugin?

@bcardiff
Copy link
Member

bcardiff commented Aug 5, 2020

@RockManJoe64 this fix is available in 0.4.0 released under https://marketplace.visualstudio.com/items?itemName=faustinoaq.crystal-lang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants