Skip to content

Commit

Permalink
fix(monaco): getDiagnostics throws "TypeError: response is not a func…
Browse files Browse the repository at this point in the history
…tion"
  • Loading branch information
johnsoncodehk committed Sep 7, 2024
1 parent 2787b79 commit e1b7ced
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/kit/lib/createChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function createTypeScriptCheckerWorker(
fileName = asPosix(fileName);
const uri = asUri(fileName);
const languageService = getLanguageServiceForFile(fileName);
return languageService.getDiagnostics(uri);
return languageService.getDiagnostics(uri, () => { });
}

async function fixErrors(fileName: string, diagnostics: Diagnostic[], only: string[] | undefined, writeFile: (fileName: string, newText: string) => Promise<void>) {
Expand Down
4 changes: 2 additions & 2 deletions packages/language-service/lib/features/provideDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function register(context: LanguageServiceContext) {

return async (
uri: URI,
response?: (result: vscode.Diagnostic[]) => void,
response: ((result: vscode.Diagnostic[]) => void),
token = NoneCancellationToken
) => {

Expand Down Expand Up @@ -123,7 +123,7 @@ export function register(context: LanguageServiceContext) {

function processResponse() {
if (errorsUpdated && !updateCacheRangeFailed) {
response?.(collectErrors());
response(collectErrors());
errorsUpdated = false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/monaco/lib/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export function activateMarkers(
const token = createTokenForModelChange(model);
const diagnostics = await languageService.getDiagnostics(
getRequestId(token.token, languageService),
model.uri
model.uri,
() => {}
);
token.dispose();
if (token.token.isCancellationRequested) {
Expand Down

0 comments on commit e1b7ced

Please sign in to comment.