Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

monaco-yaml

Package Overview
Dependencies
Maintainers
5
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-yaml - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

44

index.d.ts
import { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';
import { IEvent, languages } from 'monaco-editor/esm/vs/editor/editor.api';
export interface SchemasSettings {
/**
* A `Uri` file match which will trigger the schema validation. This may be a glob or an exact
* path.
*
* @example '.gitlab-ci.yml'
* @example 'file://**\/.github/actions/*.yaml'
*/
fileMatch: string[];
/**
* The JSON schema which will be used for validation. If not specified, it will be downloaded from
* `uri`.
*/
schema?: JSONSchema4 | JSONSchema6 | JSONSchema7;
/**
* The source URI of the JSON schema. The JSON schema will be downloaded from here if no schema
* was supplied. It will also be displayed as the source in hover tooltips.
*/
uri: string;
}
declare module 'monaco-editor/esm/vs/editor/editor.api' {

@@ -26,17 +49,3 @@ namespace languages.yaml {

*/
readonly schemas?: {
/**
* The URI of the schema, which is also the identifier of the schema.
*/
readonly uri: string;
/**
* A list of file names that are associated to the schema. The '*' wildcard can be used.
* For example '*.schema.json', 'package.json'
*/
readonly fileMatch?: string[];
/**
* The schema for the given URI.
*/
readonly schema?: JSONSchema4 | JSONSchema6 | JSONSchema7;
}[];
readonly schemas?: SchemasSettings[];

@@ -56,2 +65,7 @@ /**

/**
* A list of custom tags.
*/
readonly customTags?: string[];
readonly format?: boolean;

@@ -58,0 +72,0 @@ }

@@ -48,3 +48,2 @@ // src/monaco.contribution.ts

function createDiagnosticsAdapter(languageId, getWorker, defaults) {
let disposables = [];
const listeners = Object.create(null);

@@ -85,11 +84,14 @@ const resetSchema = async (resource) => {

};
disposables.push(editor.onDidCreateModel(onModelAdd), editor.onWillDisposeModel((model) => {
editor.onDidCreateModel(onModelAdd);
editor.onWillDisposeModel((model) => {
onModelRemoved(model);
resetSchema(model.uri);
}), editor.onDidChangeModelLanguage((event) => {
});
editor.onDidChangeModelLanguage((event) => {
onModelRemoved(event.model);
onModelAdd(event.model);
resetSchema(event.model.uri);
}), defaults.onDidChange(() => {
editor.getModels().forEach((model) => {
});
defaults.onDidChange(() => {
for (const model of editor.getModels()) {
if (model.getModeId() === languageId) {

@@ -99,18 +101,7 @@ onModelRemoved(model);

}
});
}), {
dispose: () => {
editor.getModels().forEach(onModelRemoved);
for (const disposable of Object.values(listeners)) {
disposable.dispose();
}
}
});
editor.getModels().forEach(onModelAdd);
return {
dispose() {
disposables.forEach((d) => d && d.dispose());
disposables = [];
}
};
for (const model of editor.getModels()) {
onModelAdd(model);
}
}

@@ -386,10 +377,3 @@ function fromPosition(position) {

let lastUsedTime = 0;
const stopWorker = () => {
if (worker) {
worker.dispose();
worker = null;
}
client = null;
};
const idleCheckInterval = setInterval(() => {
setInterval(() => {
if (!worker) {

@@ -400,6 +384,7 @@ return;

if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) {
stopWorker();
worker.dispose();
worker = void 0;
client = void 0;
}
}, 30 * 1e3);
const configChangeListener = defaults.onDidChange(() => stopWorker());
const getClient = () => {

@@ -416,3 +401,4 @@ lastUsedTime = Date.now();

prefix: defaults.diagnosticsOptions.prefix,
isKubernetes: defaults.diagnosticsOptions.isKubernetes
isKubernetes: defaults.diagnosticsOptions.isKubernetes,
customTags: defaults.diagnosticsOptions.customTags
}

@@ -424,13 +410,6 @@ });

};
return {
dispose() {
clearInterval(idleCheckInterval);
configChangeListener.dispose();
stopWorker();
},
async getLanguageServiceWorker(...resources) {
const client2 = await getClient();
await worker.withSyncedResources(resources);
return client2;
}
return async (...resources) => {
const client2 = await getClient();
await worker.withSyncedResources(resources);
return client2;
};

@@ -471,8 +450,11 @@ }

function setupMode(defaults) {
const disposables = [];
const client = createWorkerManager(defaults);
disposables.push(client);
const worker = (...uris) => client.getLanguageServiceWorker(...uris);
const worker = createWorkerManager(defaults);
const { languageId } = defaults;
disposables.push(languages3.registerCompletionItemProvider(languageId, createCompletionItemProvider(worker)), languages3.registerHoverProvider(languageId, createHoverProvider(worker)), languages3.registerDocumentSymbolProvider(languageId, createDocumentSymbolProvider(worker)), languages3.registerDocumentFormattingEditProvider(languageId, createDocumentFormattingEditProvider(worker)), languages3.registerLinkProvider(languageId, createLinkProvider(worker)), createDiagnosticsAdapter(languageId, worker, defaults), languages3.setLanguageConfiguration(languageId, richEditConfiguration));
languages3.registerCompletionItemProvider(languageId, createCompletionItemProvider(worker));
languages3.registerHoverProvider(languageId, createHoverProvider(worker));
languages3.registerDocumentSymbolProvider(languageId, createDocumentSymbolProvider(worker));
languages3.registerDocumentFormattingEditProvider(languageId, createDocumentFormattingEditProvider(worker));
languages3.registerLinkProvider(languageId, createLinkProvider(worker));
createDiagnosticsAdapter(languageId, worker, defaults);
languages3.setLanguageConfiguration(languageId, richEditConfiguration);
}

@@ -479,0 +461,0 @@

{
"name": "monaco-yaml",
"version": "3.1.0",
"version": "3.2.0",
"description": "YAML plugin for the Monaco Editor",

@@ -41,9 +41,9 @@ "homepage": "https://monaco-yaml.js.org",

"dependencies": {
"@types/json-schema": "^7.0.9",
"js-yaml": "^4.1.0",
"path-browserify": "^1.0.1",
"@types/json-schema": "^7.0.0",
"js-yaml": "^4.0.0",
"path-browserify": "^1.0.0",
"prettier": "2.0.5",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "^3.16.0",
"yaml-language-server-parser": "^0.1.2"
"vscode-languageserver-textdocument": "^1.0.0",
"vscode-languageserver-types": "^3.0.0",
"yaml-language-server-parser": "^0.1.0"
},

@@ -54,12 +54,12 @@ "peerDependencies": {

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"esbuild": "^0.12.20",
"eslint": "^7.32.0",
"eslint-config-remcohaszing": "^3.5.0",
"husky": "^7.0.1",
"lint-staged": "^11.1.1",
"@typescript-eslint/eslint-plugin": "^4.0.0",
"@typescript-eslint/parser": "^4.0.0",
"esbuild": "^0.12.0",
"eslint": "^7.0.0",
"eslint-config-remcohaszing": "^3.0.0",
"husky": "^7.0.0",
"lint-staged": "^11.0.0",
"monaco-editor": "^0.27.0",
"type-fest": "^2.1.0",
"typescript": "^4.3.5",
"type-fest": "^2.0.0",
"typescript": "^4.0.0",
"yaml-language-server": "^0.22.0"

@@ -66,0 +66,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc