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

Slint lsp allows to remove items referenced elsewhere #4872

Open
qarmin opened this issue Mar 17, 2024 · 3 comments
Open

Slint lsp allows to remove items referenced elsewhere #4872

qarmin opened this issue Mar 17, 2024 · 3 comments
Labels
a:live preview The Live preview of slintpad or the LSP (mT,bO) bug Something isn't working

Comments

@qarmin
Copy link

qarmin commented Mar 17, 2024

Slint nightly LSP plugin 17.03.2024

  • Select any item
  • remove it
  • repeat steps
  • after some time, compilation should fail and "delete" button, should remove random parts of code
simplescreenrecorder-2024-03-17_12.08.02.mp4

UI files - https://github.com/qarmin/czkawka/tree/7.0.0/krokiet/ui

@ogoffart ogoffart added bug Something isn't working a:live preview The Live preview of slintpad or the LSP (mT,bO) labels Mar 17, 2024
@hunger
Copy link
Member

hunger commented Mar 18, 2024

This ends up removing a named Element that is referenced elsewhere in the code. That's why it starts to fail compiling. I am not sure what I can do about that at this time. Remove the referencing code as well?

It should obviously not continue to delete things after it error-ed out.

@ogoffart
Copy link
Member

Remove the referencing code as well?

I don't think that's a good idea to remove the referencing code.

I think we should just not allow deleting them, and maybe showing a notification popup why we can't delete it.

(It should be easy to detect if the id is used. Similar to the code that renames ids.)

hunger added a commit to hunger/slint that referenced this issue Mar 18, 2024
Only process key events while the preview is in design mode and does
not show an error. So far the only key that actually does something
is the delete key, which deletes elements. Unfortunately we do not
know which text range is covered by the element we want to delete,
so we delete random chunks of text.

So disable that when we ran into an error.

This partially addresses slint-ui#4872.
hunger added a commit to hunger/slint that referenced this issue Mar 18, 2024
Only process key events while the preview is in design mode and does
not show an error. So far the only key that actually does something
is the delete key, which deletes elements. Unfortunately we do not
know which text range is covered by the element we want to delete,
so we delete random chunks of text.

So disable that when we ran into an error.

This partially addresses slint-ui#4872.
hunger added a commit that referenced this issue Mar 18, 2024
Only process key events while the preview is in design mode and does
not show an error. So far the only key that actually does something
is the delete key, which deletes elements. Unfortunately we do not
know which text range is covered by the element we want to delete,
so we delete random chunks of text.

So disable that when we ran into an error.

This partially addresses #4872.
@hunger
Copy link
Member

hunger commented May 2, 2024

The part where you can cause more deletions while the compilation has failed is fixed.

The part where you can delete elements that are used elsewhere is still open.

@hunger hunger changed the title Slint lsp allwos to remove items, even if compilation fails Slint lsp allows to remove items referenced elsewhere May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:live preview The Live preview of slintpad or the LSP (mT,bO) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants