Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions client/src/lsp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { onActiveFileChange } from '../services/events';
import type { LJDiagnostic } from "../types/diagnostics";
import { LJContext } from '../types/context';
import { handleContext } from '../services/context';
import { isCursorInsideLiquidJavaAnnotation } from '../services/annotation';

/**
* Starts the client and connects it to the language server
Expand All @@ -30,13 +29,6 @@ export async function runClient(context: vscode.ExtensionContext, port: number)
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ language: "java" }],
middleware: {
didSave: async (document, next) => {
// skip verification if the cursor is inside a LiquidJava annotation
if (isCursorInsideLiquidJavaAnnotation(document)) return;
await next(document);
},
},
};
extension.client = new LanguageClient("liquidJavaServer", "LiquidJava Server", serverOptions, clientOptions);

Expand Down Expand Up @@ -70,10 +62,8 @@ export async function runClient(context: vscode.ExtensionContext, port: number)

// update status bar on file save
context.subscriptions.push(
vscode.workspace.onDidSaveTextDocument(document => {
if (extension.client && !isCursorInsideLiquidJavaAnnotation(document)) {
updateStatusBar("loading");
}
vscode.workspace.onDidSaveTextDocument(() => {
if (extension.client) updateStatusBar("loading");
})
);
}
Expand Down
9 changes: 0 additions & 9 deletions client/src/services/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,3 @@ export function getActiveLiquidJavaAnnotation(document: vscode.TextDocument, pos
}
return parenthesisDepth > 0 ? lastAnnotationName : null;
}

/**
* Checks whether any cursor in the active editor is inside a LiquidJava annotation
*/
export function isCursorInsideLiquidJavaAnnotation(document: vscode.TextDocument): boolean {
const editor = vscode.window.activeTextEditor;
if (!editor || editor.document.uri.toString() !== document.uri.toString()) return false;
return editor.selections.some(selection => Boolean(getActiveLiquidJavaAnnotation(document, selection.active)));
}
2 changes: 0 additions & 2 deletions client/src/services/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { updateStateMachine } from './state-machine';
import { SELECTION_DEBOUNCE_MS } from '../utils/constants';
import { getSelectionContextVariables, normalizeRange, updateErrorAtCursor } from './context';
import { normalizeFilePath, toRange } from '../utils/utils';
import { isCursorInsideLiquidJavaAnnotation } from './annotation';

let selectionTimeout: NodeJS.Timeout | null = null;

Expand All @@ -21,7 +20,6 @@ export function registerEvents(context: vscode.ExtensionContext) {
}),
vscode.workspace.onDidSaveTextDocument(async document => {
if (document.uri.scheme !== 'file' || document.languageId !== "java") return;
if (isCursorInsideLiquidJavaAnnotation(document)) return;
await updateStateMachine(document)
}),
vscode.window.onDidChangeTextEditorSelection(event => {
Expand Down