editor with write capability
This commit is contained in:
parent
dc62943a16
commit
40a4d656ca
@ -388,6 +388,7 @@ public final class EditorWorkspace extends Workspace {
|
|||||||
openFileSession.open(bufferFrom(updatedDocument));
|
openFileSession.open(bufferFrom(updatedDocument));
|
||||||
pendingCaretContextRestore = true;
|
pendingCaretContextRestore = true;
|
||||||
refreshEditableHighlighting(updatedDocument);
|
refreshEditableHighlighting(updatedDocument);
|
||||||
|
refreshEditableSemanticState(updatedDocument);
|
||||||
statusBar.showDocumentFormatting(updatedDocument.lineSeparator(), indentationSetup.statusLabel());
|
statusBar.showDocumentFormatting(updatedDocument.lineSeparator(), indentationSetup.statusLabel());
|
||||||
tabStrip.showOpenFiles(
|
tabStrip.showOpenFiles(
|
||||||
openFileSession.openFiles(),
|
openFileSession.openFiles(),
|
||||||
@ -405,6 +406,29 @@ public final class EditorWorkspace extends Workspace {
|
|||||||
preserveViewport(() -> codeArea.setStyleSpans(0, inlineHintProjection.displayStyles()));
|
preserveViewport(() -> codeArea.setStyleSpans(0, inlineHintProjection.displayStyles()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshEditableSemanticState(final VfsDocumentOpenResult.VfsTextDocument updatedDocument) {
|
||||||
|
final EditorOpenFileBuffer fileBuffer = openFileSession.activeFile().orElse(null);
|
||||||
|
if (fileBuffer == null || !fileBuffer.path().equals(updatedDocument.path())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!updatedDocument.accessContext().frontendDocument()) {
|
||||||
|
scopeGuideModel = EditorDocumentScopeGuideModel.empty();
|
||||||
|
activeGuides = EditorDocumentScopeGuideModel.ActiveGuides.empty();
|
||||||
|
activeGuideParagraph = -1;
|
||||||
|
refreshParagraphGraphics();
|
||||||
|
outlinePanel.showPlaceholder();
|
||||||
|
helperPanel.showPlaceholder();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final LspAnalyzeDocumentResult analysis = prometeuLspService.analyzeDocument(
|
||||||
|
new LspAnalyzeDocumentRequest(updatedDocument.path()));
|
||||||
|
scopeGuideModel = guidesFor(fileBuffer, analysis);
|
||||||
|
activeGuides = scopeGuideModel.resolveActiveGuides(codeArea.getCaretPosition());
|
||||||
|
activeGuideParagraph = codeArea.getCurrentParagraph();
|
||||||
|
refreshParagraphGraphics();
|
||||||
|
refreshSemanticOutline(fileBuffer, analysis);
|
||||||
|
}
|
||||||
|
|
||||||
private void preserveViewport(final Runnable action) {
|
private void preserveViewport(final Runnable action) {
|
||||||
final int caretPosition = codeArea.getCaretPosition();
|
final int caretPosition = codeArea.getCaretPosition();
|
||||||
final double scrollX = codeArea.estimatedScrollXProperty().getValue();
|
final double scrollX = codeArea.estimatedScrollXProperty().getValue();
|
||||||
@ -575,10 +599,11 @@ public final class EditorWorkspace extends Workspace {
|
|||||||
if (Objects.equals(activeGuides, next) && activeGuideParagraph == currentParagraph) {
|
if (Objects.equals(activeGuides, next) && activeGuideParagraph == currentParagraph) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final boolean guidesChanged = !Objects.equals(activeGuides, next);
|
||||||
activeGuides = next;
|
activeGuides = next;
|
||||||
final boolean paragraphChanged = activeGuideParagraph != currentParagraph;
|
final boolean paragraphChanged = activeGuideParagraph != currentParagraph;
|
||||||
activeGuideParagraph = currentParagraph;
|
activeGuideParagraph = currentParagraph;
|
||||||
if (!paragraphChanged) {
|
if (!paragraphChanged && !guidesChanged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
refreshParagraphGraphics();
|
refreshParagraphGraphics();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user