Skip to content

Commit

Permalink
Use the marker data provider revalidate method
Browse files Browse the repository at this point in the history
This saves the need to dispose and recreate it entirely.
  • Loading branch information
remcohaszing committed Apr 26, 2024
1 parent df07acc commit cac9739
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export interface MonacoYaml extends IDisposable {
/**
* Recondigure `monaco-yaml`.
*/
update: (options: MonacoYamlOptions) => undefined
update: (options: MonacoYamlOptions) => Promise<undefined>
}

/**
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,9 @@ export function configureMonacoYaml(monaco: MonacoEditor, options: MonacoYamlOpt
markerDataProvider.dispose()
},

update(newOptions) {
async update(newOptions) {
worker.updateCreateData(Object.assign(createData, newOptions))
markerDataProvider.dispose()
markerDataProvider = registerMarkerDataProvider(
monaco,
'yaml',
createMarkerDataProvider(worker.getWorker)
)
await markerDataProvider.revalidate()
}
}
}

0 comments on commit cac9739

Please sign in to comment.