Skip to content

Commit

Permalink
Fix: Middlewares also expect null regions
Browse files Browse the repository at this point in the history
  • Loading branch information
idillon-sfl committed Nov 14, 2023
1 parent 1ce27a2 commit c8712c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/language/middlewareCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getEmbeddedLanguageDocPosition } from './utils'

export const middlewareProvideCompletion: CompletionMiddleware['provideCompletionItem'] = async (document, position, context, token, next) => {
const embeddedLanguageDocInfos = await requestsManager.getEmbeddedLanguageDocInfos(document.uri.toString(), position)
if (embeddedLanguageDocInfos === undefined) {
if (embeddedLanguageDocInfos === undefined || embeddedLanguageDocInfos === null) {
return await next(document, position, context, token)
}
const adjustedPosition = await getEmbeddedLanguageDocPosition(document, embeddedLanguageDocInfos, position)
Expand Down
2 changes: 1 addition & 1 deletion client/src/language/middlewareHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getEmbeddedLanguageDocPosition } from './utils'

export const middlewareProvideHover: HoverMiddleware['provideHover'] = async (document, position, token, next) => {
const embeddedLanguageDocInfos = await requestsManager.getEmbeddedLanguageDocInfos(document.uri.toString(), position)
if (embeddedLanguageDocInfos === undefined) {
if (embeddedLanguageDocInfos === undefined || embeddedLanguageDocInfos === null) {
return await next(document, position, token)
}
const adjustedPosition = await getEmbeddedLanguageDocPosition(document, embeddedLanguageDocInfos, position)
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/src/types/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface RequestParams {
}

export interface RequestResult {
[RequestType.EmbeddedLanguageDocInfos]: Promise<EmbeddedLanguageDocInfos | undefined>
[RequestType.EmbeddedLanguageDocInfos]: Promise<EmbeddedLanguageDocInfos | undefined | null> // for unknown reasons, the client receives null instead of undefined
}

interface RequestEmbeddedLanguageDocInfosParams {
Expand Down

0 comments on commit c8712c7

Please sign in to comment.