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

39 vscode extension better status bar information #48

Conversation

umutdural
Copy link
Collaborator

  • The texts on the status bar are replaced to better reflect the current state of Caesar.
  • Command links in status bar tooltip are now working.
  • Tooltip changes (e.g. visible command links) based on the state of Caesar.
  • LSP server doesn't delete the information related to all files upon receiving a verify request. Instead it only deletes the information about the file that the verify request is sent for.
  • Multiple visible tabs can be decorated w.r.t. the verification statuses of each file. Status bar tooltip displays information for each visible file in a vertical list.

Closes #39.

Copy link
Collaborator

@Philipp15b Philipp15b left a comment

Choose a reason for hiding this comment

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

Thanks a lot! This will eliminate a lot of confusion I've seen with people using Caesar. I've left some minor comments.

There's also an issue I've discovered: If there's a syntax error, a name cannot be resolved, or if there's a type error, then the status bar will falsely show "Verified!". I don't know where in the code this should be fixed, but it's definitely very confusing.

this.view.show();
} else {
this.view.hide();
}
}

private extendedTooltip(extension: vscode.MarkdownString) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like there is a return type missing? I wonder why TypeScript doesn't complain about this.

Also, I think this method should be inlined. As far as I can tell, it's just used once.

this.view.tooltip.isTrusted = true;
}

private countResults(results: [Range, VerifyResult][]): [number, number, number] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see a reason why this is a member function. Either make it a freestanding function or just inline its definition as well (I prefer the latter).

private view: StatusBarItem;
private tooltipBase: vscode.MarkdownString = stoppedTooltipBase;
private tooltipExtension: vscode.MarkdownString = new vscode.MarkdownString();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename this to tooltipStatusText? The current name is a bit confusing to me.

private view: StatusBarItem;
private tooltipBase: vscode.MarkdownString = stoppedTooltipBase;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename this to tooltipMenuText?

Copy link
Collaborator

@Philipp15b Philipp15b left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I've left a few very minor comments. After those we can merge!

@@ -157,6 +157,13 @@ impl Files {
self.files.iter().find(|file| &file.path == path)
}

pub fn find_uri(&self, document_id: TextDocumentIdentifier) -> Option<&Arc<StoredFile>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this method necessary? Why not just call find(SourceFilePath::Lsp(ident))?

.lock()
.unwrap()
.find_uri(params.text_document.clone())
.unwrap_or_else(|| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Possibly just turn this into an .expect("Could not find file id for document"). The unwrap_or_else with a panic is a bit weird to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Clippy complains about the expect and suggests the unwrap_or_else version. I think this is why the unwrap_or_else version is previously preferred in the run_server method as well.

let someVerified = false;

const editorsWithResults = vscode.window.visibleTextEditors.filter((editor) => {
return editor.document.languageId === "heyvl" // Only HeyVL files
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need to check for HeyVL files? Shouldn't this.verifyStatus already only contain just HeyVL files?

for (const editor of editorsWithResults) {
const document_id: TextDocumentIdentifier = { uri: editor.document.uri.toString() };

// The default will not be used because the filter above ensures that the document is in the map.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why handle the default case then with ?? []? Why not just throw an error then?

this.view.show();
} else {
this.view.hide();
}
}

private renderTooltip() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a comment that this renders the tooltip with the text provided in this.tooltipMenuText? Alternatively, just add tooltipMenuText as a parameter to this function and don't have it as an attribute at all?

}


private handleReadyStatus() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe call this renderStatusReady

Copy link
Collaborator

@Philipp15b Philipp15b left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@Philipp15b Philipp15b merged commit 12227b9 into moves-rwth:main Oct 25, 2024
4 checks passed
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.

vscode extension: better status bar information
2 participants