Skip to content

Commit

Permalink
Enable ESLint rule jsdoc/require-jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed May 10, 2024
1 parent 8570a4d commit 28b7345
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ extends:
rules:
import/no-extraneous-dependencies: off

jsdoc/require-jsdoc: off

n/no-extraneous-import: off
10 changes: 10 additions & 0 deletions examples/demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions fillers/vscode-nls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 38 additions & 0 deletions src/yaml.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
const response = await fetch(uri)
if (response.ok) {
Expand All @@ -34,24 +42,54 @@ async function schemaRequestService(uri: string): Promise<string> {
* @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
}

Expand Down

0 comments on commit 28b7345

Please sign in to comment.