This commit is contained in:
21
node_modules/volar-service-yaml/LICENSE
generated
vendored
Normal file
21
node_modules/volar-service-yaml/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023-present Remco Haszing
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
25
node_modules/volar-service-yaml/README.md
generated
vendored
Normal file
25
node_modules/volar-service-yaml/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# volar-service-yaml
|
||||
|
||||
Volar plugin for [`yaml-language-server`](https://github.com/redhat-developer/yaml-language-server).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install volar-service-yaml
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`volar.config.js`
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
services: [
|
||||
require('volar-service-yaml').create(),
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE) © [Remco Haszing](https://github.com/remcohaszing)
|
||||
15
node_modules/volar-service-yaml/index.d.ts
generated
vendored
Normal file
15
node_modules/volar-service-yaml/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Disposable, DocumentSelector, ProviderResult, LanguageServiceContext, LanguageServicePlugin } from '@volar/language-service';
|
||||
import * as yaml from 'yaml-language-server';
|
||||
export interface Provide {
|
||||
'yaml/languageService': () => yaml.LanguageService;
|
||||
}
|
||||
/**
|
||||
* Create a Volar language service for YAML documents.
|
||||
*/
|
||||
export declare function create({ documentSelector, getWorkspaceContextService, getLanguageSettings, onDidChangeLanguageSettings, }?: {
|
||||
documentSelector?: DocumentSelector;
|
||||
getWorkspaceContextService?(context: LanguageServiceContext): yaml.WorkspaceContextService;
|
||||
getLanguageSettings?(context: LanguageServiceContext): ProviderResult<yaml.LanguageSettings>;
|
||||
onDidChangeLanguageSettings?(listener: () => void, context: LanguageServiceContext): Disposable;
|
||||
}): LanguageServicePlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
165
node_modules/volar-service-yaml/index.js
generated
vendored
Normal file
165
node_modules/volar-service-yaml/index.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.create = create;
|
||||
const vscode_uri_1 = require("vscode-uri");
|
||||
const yaml = require("yaml-language-server");
|
||||
function noop() { }
|
||||
/**
|
||||
* Create a Volar language service for YAML documents.
|
||||
*/
|
||||
function create({ documentSelector = ['yaml'], getWorkspaceContextService = context => {
|
||||
return {
|
||||
resolveRelativePath(relativePath, resource) {
|
||||
const base = resource.substring(0, resource.lastIndexOf('/') + 1);
|
||||
let baseUri = vscode_uri_1.URI.parse(base);
|
||||
const decoded = context.decodeEmbeddedDocumentUri(baseUri);
|
||||
if (decoded) {
|
||||
baseUri = decoded[0];
|
||||
}
|
||||
return vscode_uri_1.Utils.resolvePath(baseUri, relativePath).toString();
|
||||
},
|
||||
};
|
||||
}, getLanguageSettings = () => {
|
||||
return {
|
||||
completion: true,
|
||||
customTags: [],
|
||||
format: true,
|
||||
hover: true,
|
||||
isKubernetes: false,
|
||||
validate: true,
|
||||
yamlVersion: '1.2',
|
||||
};
|
||||
}, onDidChangeLanguageSettings = () => {
|
||||
return { dispose() { } };
|
||||
}, } = {}) {
|
||||
return {
|
||||
name: 'yaml',
|
||||
capabilities: {
|
||||
codeActionProvider: {},
|
||||
codeLensProvider: {
|
||||
resolveProvider: true,
|
||||
},
|
||||
completionProvider: {
|
||||
triggerCharacters: [' ', ':'],
|
||||
},
|
||||
definitionProvider: true,
|
||||
diagnosticProvider: {
|
||||
interFileDependencies: false,
|
||||
workspaceDiagnostics: false,
|
||||
},
|
||||
documentOnTypeFormattingProvider: {
|
||||
triggerCharacters: ['\n']
|
||||
},
|
||||
documentSymbolProvider: true,
|
||||
hoverProvider: true,
|
||||
documentLinkProvider: {},
|
||||
foldingRangeProvider: true,
|
||||
selectionRangeProvider: true,
|
||||
},
|
||||
create(context) {
|
||||
const ls = yaml.getLanguageService({
|
||||
schemaRequestService: async (uri) => await context.env.fs?.readFile(vscode_uri_1.URI.parse(uri)) ?? '',
|
||||
telemetry: {
|
||||
send: noop,
|
||||
sendError: noop,
|
||||
sendTrack: noop
|
||||
},
|
||||
// @ts-expect-error https://github.com/redhat-developer/yaml-language-server/pull/910
|
||||
clientCapabilities: context.env?.clientCapabilities,
|
||||
workspaceContext: getWorkspaceContextService(context),
|
||||
});
|
||||
const disposable = onDidChangeLanguageSettings(() => initializing = undefined, context);
|
||||
let initializing;
|
||||
return {
|
||||
dispose() {
|
||||
disposable.dispose();
|
||||
},
|
||||
provide: {
|
||||
'yaml/languageService': () => ls
|
||||
},
|
||||
provideCodeActions(document, range, context) {
|
||||
return worker(document, () => {
|
||||
return ls.getCodeAction(document, {
|
||||
context,
|
||||
range,
|
||||
textDocument: document
|
||||
});
|
||||
});
|
||||
},
|
||||
provideCodeLenses(document) {
|
||||
return worker(document, () => {
|
||||
return ls.getCodeLens(document);
|
||||
});
|
||||
},
|
||||
provideCompletionItems(document, position) {
|
||||
return worker(document, () => {
|
||||
return ls.doComplete(document, position, false);
|
||||
});
|
||||
},
|
||||
provideDefinition(document, position) {
|
||||
return worker(document, () => {
|
||||
return ls.doDefinition(document, { position, textDocument: document });
|
||||
});
|
||||
},
|
||||
provideDiagnostics(document) {
|
||||
return worker(document, () => {
|
||||
return ls.doValidation(document, false);
|
||||
});
|
||||
},
|
||||
provideDocumentSymbols(document) {
|
||||
return worker(document, () => {
|
||||
return ls.findDocumentSymbols2(document, {});
|
||||
});
|
||||
},
|
||||
provideHover(document, position) {
|
||||
return worker(document, () => {
|
||||
return ls.doHover(document, position);
|
||||
});
|
||||
},
|
||||
provideDocumentLinks(document) {
|
||||
return worker(document, () => {
|
||||
return ls.findLinks(document);
|
||||
});
|
||||
},
|
||||
provideFoldingRanges(document) {
|
||||
return worker(document, () => {
|
||||
return ls.getFoldingRanges(document, context.env.clientCapabilities?.textDocument?.foldingRange ?? {});
|
||||
});
|
||||
},
|
||||
provideOnTypeFormattingEdits(document, position, key, options) {
|
||||
return worker(document, () => {
|
||||
return ls.doDocumentOnTypeFormatting(document, { ch: key, options, position, textDocument: document });
|
||||
});
|
||||
},
|
||||
provideSelectionRanges(document, positions) {
|
||||
return worker(document, () => {
|
||||
return ls.getSelectionRanges(document, positions);
|
||||
});
|
||||
},
|
||||
resolveCodeLens(codeLens) {
|
||||
return ls.resolveCodeLens(codeLens);
|
||||
},
|
||||
};
|
||||
async function worker(document, callback) {
|
||||
if (!matchDocument(documentSelector, document)) {
|
||||
return;
|
||||
}
|
||||
await (initializing ??= initialize());
|
||||
return await callback();
|
||||
}
|
||||
async function initialize() {
|
||||
const settings = await getLanguageSettings(context);
|
||||
ls.configure(settings);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
function matchDocument(selector, document) {
|
||||
for (const sel of selector) {
|
||||
if (sel === document.languageId || (typeof sel === 'object' && sel.language === document.languageId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
42
node_modules/volar-service-yaml/package.json
generated
vendored
Normal file
42
node_modules/volar-service-yaml/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "volar-service-yaml",
|
||||
"version": "0.0.62",
|
||||
"description": "Integrate yaml-language-server into Volar",
|
||||
"homepage": "https://github.com/volarjs/services/tree/master/packages/yaml",
|
||||
"bugs": "https://github.com/volarjs/services/issues",
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"volar-service"
|
||||
],
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"**/*.js",
|
||||
"**/*.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/volarjs/services.git",
|
||||
"directory": "packages/yaml"
|
||||
},
|
||||
"author": {
|
||||
"name": "Remco Haszing",
|
||||
"email": "remcohaszing@gmail.com",
|
||||
"url": "https://github.com/remcohaszing"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-uri": "^3.0.8",
|
||||
"yaml-language-server": "~1.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vscode-languageserver-textdocument": "^1.0.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@volar/language-service": "~2.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@volar/language-service": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"gitHead": "f1ddbdc4d9df0772db5a0d46ff8ff64eecc9de02"
|
||||
}
|
||||
Reference in New Issue
Block a user