diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 91b97ac..1b22fe8 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -3,6 +3,4 @@ extends: rules: import/no-extraneous-dependencies: off - jsdoc/require-jsdoc: off - n/no-extraneous-import: off diff --git a/examples/demo/src/index.ts b/examples/demo/src/index.ts index 0bd301a..0cfd1c5 100644 --- a/examples/demo/src/index.ts +++ b/examples/demo/src/index.ts @@ -151,6 +151,16 @@ select.addEventListener('change', () => { oldModel?.dispose() }) +/** + * Get the document symbols that contain the given position. + * + * @param symbols + * The symbols to iterate. + * @param position + * The position for which to filter document symbols. + * @yields + * The document symbols that contain the given position. + */ function* iterateSymbols( symbols: languages.DocumentSymbol[], position: Position diff --git a/fillers/vscode-nls.ts b/fillers/vscode-nls.ts index cce499f..d3ba492 100644 --- a/fillers/vscode-nls.ts +++ b/fillers/vscode-nls.ts @@ -5,10 +5,22 @@ const localize: LocalizeFunc = (key, message, ...args) => ? message : message.replace(/{(\d+)}/g, (match, [index]) => (index in args ? String(args[index]) : match)) +/** + * Get {@link localize} + * + * @returns + * See {@link localize} + */ export function loadMessageBundle(): LocalizeFunc { return localize } +/** + * Get {@link loadMessageBundle} + * + * @returns + * See {@link loadMessageBundle} + */ export function config(): LoadFunc { return loadMessageBundle } diff --git a/src/index.ts b/src/index.ts index 38bada7..a5f5748 100644 --- a/src/index.ts +++ b/src/index.ts @@ -129,7 +129,6 @@ export interface MonacoYaml extends IDisposable { * @returns * A disposable object that can be used to update `monaco-yaml` */ - export function configureMonacoYaml(monaco: MonacoEditor, options: MonacoYamlOptions): MonacoYaml { const createData: MonacoYamlOptions = { completion: true, diff --git a/src/yaml.worker.ts b/src/yaml.worker.ts index 89763b4..ce02bd7 100644 --- a/src/yaml.worker.ts +++ b/src/yaml.worker.ts @@ -22,6 +22,14 @@ import { import { type MonacoYamlOptions } from './index.js' +/** + * Fetch the given URL and return the response body as text. + * + * @param uri + * The uri to fetch. + * @returns + * The response body as text. + */ async function schemaRequestService(uri: string): Promise { const response = await fetch(uri) if (response.ok) { @@ -34,24 +42,54 @@ async function schemaRequestService(uri: string): Promise { * @internal */ export interface YAMLWorker { + /** + * Validate a document. + */ doValidation: (uri: string) => Diagnostic[] | undefined + /** + * Get completions in a YAML document. + */ doComplete: (uri: string, position: Position) => CompletionList | undefined + /** + * Get definitions in a YAML document. + */ doDefinition: (uri: string, position: Position) => LocationLink[] | undefined + /** + * Get hover information in a YAML document. + */ doHover: (uri: string, position: Position) => Hover | null | undefined + /** + * Format a YAML document using Prettier. + */ format: (uri: string) => TextEdit[] | undefined + /** + * Reset the schema state for a YAML document. + */ resetSchema: (uri: string) => boolean + /** + * Get document symbols in a YAML document. + */ findDocumentSymbols: (uri: string) => DocumentSymbol[] | undefined + /** + * Get links in a YAML document. + */ findLinks: (uri: string) => DocumentLink[] | undefined + /** + * Get code actions in a YAML document. + */ getCodeAction: (uri: string, range: Range, context: CodeActionContext) => CodeAction[] | undefined + /** + * Get folding ranges in a YAML document. + */ getFoldingRanges: (uri: string) => FoldingRange[] | null | undefined }