-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Expose API to check documents from other extensions (#3327)
- Loading branch information
Showing
5 changed files
with
31 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type * as API from 'code-spell-checker-server/api'; | ||
|
||
import * as di from './di.mjs'; | ||
|
||
export type DocumentInfo = API.TextDocumentInfo; | ||
export type CheckDocumentOptions = API.CheckDocumentOptions; | ||
export type CheckDocumentResponse = API.CheckDocumentResult; | ||
|
||
export async function checkDocument(doc: DocumentInfo, options?: CheckDocumentOptions): Promise<CheckDocumentResponse> { | ||
const client = di.get('client'); | ||
return client.serverApi.checkDocument(doc, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
import type { Uri } from 'vscode'; | ||
|
||
import type { CheckDocumentOptions, CheckDocumentResponse, DocumentInfo } from './api.mjs'; | ||
import type { CSpellClient } from './client/index.mjs'; | ||
import type { ConfigTargetLegacy } from './settings/index.mjs'; | ||
|
||
export interface ExtensionApi { | ||
registerConfig(path: string): void; | ||
triggerGetSettings(): void; | ||
enableLanguageId(languageId: string, uri?: string): Thenable<void>; | ||
disableLanguageId(languageId: string, uri?: string): Thenable<void>; | ||
enableCurrentFileType(): Thenable<void>; | ||
disableCurrentFileType(): Thenable<void>; | ||
addWordToUserDictionary(word: string): Thenable<void>; | ||
addWordToWorkspaceDictionary(word: string, uri?: string | null | Uri): Thenable<void>; | ||
enableLocale(target: ConfigTargetLegacy, locale: string): Thenable<void>; | ||
disableLocale(target: ConfigTargetLegacy, locale: string): Thenable<void>; | ||
enableLanguageId(languageId: string, uri?: string): Promise<void>; | ||
disableLanguageId(languageId: string, uri?: string): Promise<void>; | ||
enableCurrentFileType(): Promise<void>; | ||
disableCurrentFileType(): Promise<void>; | ||
addWordToUserDictionary(word: string): Promise<void>; | ||
addWordToWorkspaceDictionary(word: string, uri?: string | null | Uri): Promise<void>; | ||
enableLocale(target: ConfigTargetLegacy, locale: string): Promise<void>; | ||
disableLocale(target: ConfigTargetLegacy, locale: string): Promise<void>; | ||
updateSettings(): boolean; | ||
cSpellClient(): CSpellClient; | ||
checkDocument(doc: DocumentInfo, options?: CheckDocumentOptions): Promise<CheckDocumentResponse>; | ||
|
||
/** | ||
* @deprecated use {@link ExtensionApi.enableLocale} | ||
*/ | ||
enableLocal(isGlobal: boolean, locale: string): Thenable<void>; | ||
enableLocal(isGlobal: boolean, locale: string): Promise<void>; | ||
/** | ||
* @deprecated use {@link ExtensionApi.disableLocale} | ||
*/ | ||
disableLocal(isGlobal: boolean, locale: string): Thenable<void>; | ||
disableLocal(isGlobal: boolean, locale: string): Promise<void>; | ||
/** | ||
* @deprecated use {@link ExtensionApi.enableCurrentFileType} | ||
*/ | ||
enableCurrentLanguage(): Thenable<void>; | ||
enableCurrentLanguage(): Promise<void>; | ||
/** | ||
* @deprecated use {@link ExtensionApi.disableCurrentFileType} | ||
*/ | ||
disableCurrentLanguage(): Thenable<void>; | ||
disableCurrentLanguage(): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters