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

Lsp: Report progress #1923

Merged
merged 2 commits into from Dec 1, 2022
Merged

Lsp: Report progress #1923

merged 2 commits into from Dec 1, 2022

Conversation

hunger
Copy link
Member

@hunger hunger commented Nov 28, 2022

!!! Sits on top of #1922 !!!

I want to abuse this to notify the Properties View (and potentially others) about files getting processed by the LSP.

Currently we have this flow of information:

sequenceDiagram
    participant Editor
    participant PropertiesView
    participant LSP

    Editor->>PropertiesView: Something changed
    PropertiesView->>LSP: PropertyData?
    LSP->>PropertiesView: No or outdated data
    Editor->>LSP: Something changed
    loop Parse change
        LSP->>LSP: Do magic
    end
    
    Editor->>PropertiesView: Cursor Change
    PropertiesView->>LSP: PropertyData?
    LSP->>PropertiesView: Current PropertiesData!

    PropertiesView->>LSP: change property X
    LSP->>Editor: change property X

    Editor->>LSP: Changed!
    LSP->>PropertiesView: property X changed
    Editor->>LSP: After changing X, my contents is now...

I hope I can abuse the progress report to do this instead:

sequenceDiagram
    participant Editor
    participant PropertiesView
    participant LSP

    LSP->>PropertiesView: No or outdated data
    Editor->>LSP: Something changed
    LSP->>PropertiesView: Invalidate data when progress starts
    loop Parse change
        LSP->>LSP: Do magic
    end
    LSP->>PropertiesView: Progress done: My data is valid again!
    PropertiesView->>LSP: PropertyData?
    LSP->>PropertiesView: Current PropertiesData!

    PropertiesView->>LSP: change property X
    LSP->>Editor: change property X
    Editor->>LSP: Changed!
    LSP->>PropertiesView: property X changed

    Editor->>LSP: After changing X, my contents is now...
    LSP->>PropertiesView: Invalidate data when progress starts
    loop Parse change
        LSP->>LSP: Do magic
    end
    LSP->>PropertiesView: Progress done: My data is valid again!
    PropertiesView->>LSP: PropertyData?
    LSP->>PropertiesView: Current PropertiesData!    

@ogoffart
Copy link
Member

What is this magic things here that the loop does?
The loading and reloading of document is totally synchronous on the non-browser version. (and you did not implement the thing for the browser version)

@hunger
Copy link
Member Author

hunger commented Nov 29, 2022

It parses the files, which takes a moment. Think of those boxes as "some time passes".

The problem is that the Editor drives synchronization at this time and that has no idea what state the data in the LSP is in. I want to change it such that the the PropertiesView only gets position changes from the Editor and all the data synchronization happens via the LSP.

@ogoffart
Copy link
Member

Does it means we'll see popup all the time in vscode?

@hunger
Copy link
Member Author

hunger commented Nov 29, 2022

I see that our LSP sent progress information to VSCode in the traces, but I did not see VSCode report them anywhere. So I think it won't pop up messages:-)

Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then it seems like a good idea.

@hunger hunger merged commit 0dee4fa into slint-ui:master Dec 1, 2022
@hunger hunger deleted the lsp_progress branch December 1, 2022 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants