Skip to content

Commit

Permalink
Remove formatting options argument
Browse files Browse the repository at this point in the history
It’s always empty. There’s no need to pass this to the worker.
  • Loading branch information
remcohaszing committed Sep 6, 2023
1 parent 2151e52 commit d8aa128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/languageFeatures.ts
Expand Up @@ -117,7 +117,7 @@ export function createDocumentFormattingEditProvider(
const resource = model.uri

const worker = await getWorker(resource)
const edits = await worker.format(String(resource), {})
const edits = await worker.format(String(resource))

return edits?.map(toTextEdit)
}
Expand Down
7 changes: 3 additions & 4 deletions src/yaml.worker.ts
Expand Up @@ -15,7 +15,6 @@ import {
} from 'vscode-languageserver-types'
import { type Telemetry } from 'yaml-language-server/lib/esm/languageservice/telemetry.js'
import {
type CustomFormatterOptions,
getLanguageService,
type WorkspaceContextService
} from 'yaml-language-server/lib/esm/languageservice/yamlLanguageService.js'
Expand All @@ -37,7 +36,7 @@ export interface YAMLWorker {

doHover: (uri: string, position: Position) => Hover | null | undefined

format: (uri: string, options: CustomFormatterOptions) => TextEdit[] | undefined
format: (uri: string) => TextEdit[] | undefined

resetSchema: (uri: string) => boolean | undefined

Expand Down Expand Up @@ -113,10 +112,10 @@ initialize<YAMLWorker, MonacoYamlOptions>((ctx, { enableSchemaRequest, ...langua
}
},

format(uri, options) {
format(uri) {
const document = getTextDocument(uri)
if (document) {
return ls.doFormat(document, options)
return ls.doFormat(document, {})
}
},

Expand Down

0 comments on commit d8aa128

Please sign in to comment.