This commit is contained in:
48
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.d.ts
generated
vendored
48
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.d.ts
generated
vendored
@@ -1,48 +0,0 @@
|
||||
import { Node, Pair } from 'yaml';
|
||||
export declare type YamlNode = Node | Pair;
|
||||
export declare type ASTNode = ObjectASTNode | PropertyASTNode | ArrayASTNode | StringASTNode | NumberASTNode | BooleanASTNode | NullASTNode;
|
||||
export interface BaseASTNode {
|
||||
readonly type: 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null';
|
||||
readonly parent?: ASTNode;
|
||||
readonly offset: number;
|
||||
readonly length: number;
|
||||
readonly children?: ASTNode[];
|
||||
readonly value?: string | boolean | number | null;
|
||||
readonly internalNode: YamlNode;
|
||||
location: string;
|
||||
getNodeFromOffsetEndInclusive(offset: number): ASTNode;
|
||||
}
|
||||
export interface ObjectASTNode extends BaseASTNode {
|
||||
readonly type: 'object';
|
||||
readonly properties: PropertyASTNode[];
|
||||
readonly children: ASTNode[];
|
||||
}
|
||||
export interface PropertyASTNode extends BaseASTNode {
|
||||
readonly type: 'property';
|
||||
readonly keyNode: StringASTNode;
|
||||
readonly valueNode?: ASTNode;
|
||||
readonly colonOffset?: number;
|
||||
readonly children: ASTNode[];
|
||||
}
|
||||
export interface ArrayASTNode extends BaseASTNode {
|
||||
readonly type: 'array';
|
||||
readonly items: ASTNode[];
|
||||
readonly children: ASTNode[];
|
||||
}
|
||||
export interface StringASTNode extends BaseASTNode {
|
||||
readonly type: 'string';
|
||||
readonly value: string;
|
||||
}
|
||||
export interface NumberASTNode extends BaseASTNode {
|
||||
readonly type: 'number';
|
||||
readonly value: number;
|
||||
readonly isInteger: boolean;
|
||||
}
|
||||
export interface BooleanASTNode extends BaseASTNode {
|
||||
readonly type: 'boolean';
|
||||
readonly value: boolean;
|
||||
}
|
||||
export interface NullASTNode extends BaseASTNode {
|
||||
readonly type: 'null';
|
||||
readonly value: null;
|
||||
}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export {};
|
||||
//# sourceMappingURL=jsonASTTypes.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/jsonASTTypes.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"jsonASTTypes.js","sourceRoot":"","sources":["../../../src/languageservice/jsonASTTypes.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
||||
79
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.d.ts
generated
vendored
79
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.d.ts
generated
vendored
@@ -1,79 +0,0 @@
|
||||
import { CompletionItemKind } from 'vscode-json-languageservice';
|
||||
import { SchemaVersions } from './yamlTypes';
|
||||
export declare type JSONSchemaRef = JSONSchema | boolean;
|
||||
export interface JSONSchema {
|
||||
id?: string;
|
||||
$id?: string;
|
||||
$schema?: string;
|
||||
url?: string;
|
||||
type?: string | string[];
|
||||
title?: string;
|
||||
closestTitle?: string;
|
||||
versions?: SchemaVersions;
|
||||
default?: any;
|
||||
definitions?: {
|
||||
[name: string]: JSONSchema;
|
||||
};
|
||||
description?: string;
|
||||
properties?: JSONSchemaMap;
|
||||
patternProperties?: JSONSchemaMap;
|
||||
additionalProperties?: boolean | JSONSchemaRef;
|
||||
minProperties?: number;
|
||||
maxProperties?: number;
|
||||
dependencies?: JSONSchemaMap | {
|
||||
[prop: string]: string[];
|
||||
};
|
||||
items?: JSONSchemaRef | JSONSchemaRef[];
|
||||
minItems?: number;
|
||||
maxItems?: number;
|
||||
uniqueItems?: boolean;
|
||||
additionalItems?: boolean | JSONSchemaRef;
|
||||
pattern?: string;
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
minimum?: number;
|
||||
maximum?: number;
|
||||
exclusiveMinimum?: boolean | number;
|
||||
exclusiveMaximum?: boolean | number;
|
||||
multipleOf?: number;
|
||||
required?: string[];
|
||||
$ref?: string;
|
||||
_$ref?: string;
|
||||
anyOf?: JSONSchemaRef[];
|
||||
allOf?: JSONSchemaRef[];
|
||||
oneOf?: JSONSchemaRef[];
|
||||
not?: JSONSchemaRef;
|
||||
enum?: any[];
|
||||
format?: string;
|
||||
const?: any;
|
||||
contains?: JSONSchemaRef;
|
||||
propertyNames?: JSONSchemaRef;
|
||||
examples?: any[];
|
||||
$comment?: string;
|
||||
if?: JSONSchemaRef;
|
||||
then?: JSONSchemaRef;
|
||||
else?: JSONSchemaRef;
|
||||
defaultSnippets?: {
|
||||
label?: string;
|
||||
description?: string;
|
||||
markdownDescription?: string;
|
||||
type?: string;
|
||||
suggestionKind?: CompletionItemKind;
|
||||
sortText?: string;
|
||||
body?: any;
|
||||
bodyText?: string;
|
||||
}[];
|
||||
errorMessage?: string;
|
||||
patternErrorMessage?: string;
|
||||
deprecationMessage?: string;
|
||||
enumDescriptions?: string[];
|
||||
markdownEnumDescriptions?: string[];
|
||||
markdownDescription?: string;
|
||||
doNotSuggest?: boolean;
|
||||
allowComments?: boolean;
|
||||
schemaSequence?: JSONSchema[];
|
||||
filePatternAssociation?: string;
|
||||
}
|
||||
export interface JSONSchemaMap {
|
||||
[name: string]: JSONSchemaRef;
|
||||
}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export {};
|
||||
//# sourceMappingURL=jsonSchema.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"jsonSchema.js","sourceRoot":"","sources":["../../../src/languageservice/jsonSchema.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/parser/ast-converter.d.ts
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/parser/ast-converter.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import { Document, LineCounter } from 'yaml';
|
||||
import { ASTNode, YamlNode } from '../jsonASTTypes';
|
||||
declare type NodeRange = [number, number, number];
|
||||
export declare function convertAST(parent: ASTNode, node: YamlNode, doc: Document, lineCounter: LineCounter): ASTNode | undefined;
|
||||
export declare function toOffsetLength(range: NodeRange): [number, number];
|
||||
export {};
|
||||
168
node_modules/yaml-language-server/lib/esm/languageservice/parser/ast-converter.js
generated
vendored
168
node_modules/yaml-language-server/lib/esm/languageservice/parser/ast-converter.js
generated
vendored
@@ -1,168 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { isScalar, isMap, isPair, isSeq, isNode, isAlias, } from 'yaml';
|
||||
import { NullASTNodeImpl, PropertyASTNodeImpl, StringASTNodeImpl, ObjectASTNodeImpl, NumberASTNodeImpl, ArrayASTNodeImpl, BooleanASTNodeImpl, } from './jsonParser07';
|
||||
const maxRefCount = 1000;
|
||||
let refDepth = 0;
|
||||
const seenAlias = new Set();
|
||||
export function convertAST(parent, node, doc, lineCounter) {
|
||||
if (!parent) {
|
||||
// first invocation
|
||||
refDepth = 0;
|
||||
}
|
||||
if (!node) {
|
||||
return null;
|
||||
}
|
||||
if (isMap(node)) {
|
||||
return convertMap(node, parent, doc, lineCounter);
|
||||
}
|
||||
if (isPair(node)) {
|
||||
return convertPair(node, parent, doc, lineCounter);
|
||||
}
|
||||
if (isSeq(node)) {
|
||||
return convertSeq(node, parent, doc, lineCounter);
|
||||
}
|
||||
if (isScalar(node)) {
|
||||
return convertScalar(node, parent);
|
||||
}
|
||||
if (isAlias(node) && !seenAlias.has(node) && refDepth < maxRefCount) {
|
||||
seenAlias.add(node);
|
||||
const converted = convertAlias(node, parent, doc, lineCounter);
|
||||
seenAlias.delete(node);
|
||||
return converted;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function convertMap(node, parent, doc, lineCounter) {
|
||||
let range;
|
||||
if (node.flow && !node.range) {
|
||||
range = collectFlowMapRange(node);
|
||||
}
|
||||
else {
|
||||
range = node.range;
|
||||
}
|
||||
const result = new ObjectASTNodeImpl(parent, node, ...toFixedOffsetLength(range, lineCounter));
|
||||
for (const it of node.items) {
|
||||
if (isPair(it)) {
|
||||
result.properties.push(convertAST(result, it, doc, lineCounter));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function convertPair(node, parent, doc, lineCounter) {
|
||||
const keyNode = node.key;
|
||||
const valueNode = node.value;
|
||||
const rangeStart = keyNode.range[0];
|
||||
let rangeEnd = keyNode.range[1];
|
||||
let nodeEnd = keyNode.range[2];
|
||||
if (valueNode) {
|
||||
rangeEnd = valueNode.range[1];
|
||||
nodeEnd = valueNode.range[2];
|
||||
}
|
||||
// Pair does not return a range using the key/value ranges to fake one.
|
||||
const result = new PropertyASTNodeImpl(parent, node, ...toFixedOffsetLength([rangeStart, rangeEnd, nodeEnd], lineCounter));
|
||||
if (isAlias(keyNode)) {
|
||||
const keyAlias = new StringASTNodeImpl(parent, keyNode, ...toOffsetLength(keyNode.range));
|
||||
keyAlias.value = keyNode.source;
|
||||
result.keyNode = keyAlias;
|
||||
}
|
||||
else {
|
||||
result.keyNode = convertAST(result, keyNode, doc, lineCounter);
|
||||
}
|
||||
result.valueNode = convertAST(result, valueNode, doc, lineCounter);
|
||||
return result;
|
||||
}
|
||||
function convertSeq(node, parent, doc, lineCounter) {
|
||||
const result = new ArrayASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
for (const it of node.items) {
|
||||
if (isNode(it)) {
|
||||
const convertedNode = convertAST(result, it, doc, lineCounter);
|
||||
// due to recursion protection, convertAST may return undefined
|
||||
if (convertedNode) {
|
||||
result.children.push(convertedNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function convertScalar(node, parent) {
|
||||
if (node.value === null) {
|
||||
return new NullASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
}
|
||||
switch (typeof node.value) {
|
||||
case 'string': {
|
||||
const result = new StringASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
result.value = node.value;
|
||||
return result;
|
||||
}
|
||||
case 'boolean':
|
||||
return new BooleanASTNodeImpl(parent, node, node.value, ...toOffsetLength(node.range));
|
||||
case 'number': {
|
||||
const result = new NumberASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
result.value = node.value;
|
||||
result.isInteger = Number.isInteger(result.value);
|
||||
return result;
|
||||
}
|
||||
default: {
|
||||
// fail safe converting, we need to return some node anyway
|
||||
const result = new StringASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
result.value = node.source;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
function convertAlias(node, parent, doc, lineCounter) {
|
||||
refDepth++;
|
||||
const resolvedNode = node.resolve(doc);
|
||||
if (resolvedNode) {
|
||||
return convertAST(parent, resolvedNode, doc, lineCounter);
|
||||
}
|
||||
else {
|
||||
const resultNode = new StringASTNodeImpl(parent, node, ...toOffsetLength(node.range));
|
||||
resultNode.value = node.source;
|
||||
return resultNode;
|
||||
}
|
||||
}
|
||||
export function toOffsetLength(range) {
|
||||
return [range[0], range[1] - range[0]];
|
||||
}
|
||||
/**
|
||||
* Convert offsets to offset+length with fix length to not include '\n' character in some cases
|
||||
* @param range the yaml ast range
|
||||
* @param lineCounter the line counter
|
||||
* @returns the offset and length
|
||||
*/
|
||||
function toFixedOffsetLength(range, lineCounter) {
|
||||
const start = lineCounter.linePos(range[0]);
|
||||
const end = lineCounter.linePos(range[1]);
|
||||
const result = [range[0], range[1] - range[0]];
|
||||
// -1 as range may include '\n'
|
||||
if (start.line !== end.line && (lineCounter.lineStarts.length !== end.line || end.col === 1)) {
|
||||
result[1]--;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function collectFlowMapRange(node) {
|
||||
let start = Number.MAX_SAFE_INTEGER;
|
||||
let end = 0;
|
||||
for (const it of node.items) {
|
||||
if (isPair(it)) {
|
||||
if (isNode(it.key)) {
|
||||
if (it.key.range && it.key.range[0] <= start) {
|
||||
start = it.key.range[0];
|
||||
}
|
||||
}
|
||||
if (isNode(it.value)) {
|
||||
if (it.value.range && it.value.range[2] >= end) {
|
||||
end = it.value.range[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [start, end, end];
|
||||
}
|
||||
//# sourceMappingURL=ast-converter.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
||||
import { Tags } from 'yaml';
|
||||
/**
|
||||
* Converts the tags from settings and adds known tags such as !include
|
||||
* and returns Tags that can be used by the parser.
|
||||
* @param customTags Tags for parser
|
||||
*/
|
||||
export declare function getCustomTags(customTags: string[]): Tags;
|
||||
58
node_modules/yaml-language-server/lib/esm/languageservice/parser/custom-tag-provider.js
generated
vendored
58
node_modules/yaml-language-server/lib/esm/languageservice/parser/custom-tag-provider.js
generated
vendored
@@ -1,58 +0,0 @@
|
||||
import { isSeq, isMap } from 'yaml';
|
||||
import { filterInvalidCustomTags } from '../utils/arrUtils';
|
||||
class CommonTagImpl {
|
||||
constructor(tag, type) {
|
||||
this.tag = tag;
|
||||
this.type = type;
|
||||
}
|
||||
get collection() {
|
||||
if (this.type === 'mapping') {
|
||||
return 'map';
|
||||
}
|
||||
if (this.type === 'sequence') {
|
||||
return 'seq';
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
resolve(value) {
|
||||
if (isMap(value) && this.type === 'mapping') {
|
||||
return value;
|
||||
}
|
||||
if (isSeq(value) && this.type === 'sequence') {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === 'string' && this.type === 'scalar') {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
class IncludeTag {
|
||||
constructor() {
|
||||
this.tag = '!include';
|
||||
this.type = 'scalar';
|
||||
}
|
||||
resolve(value, onError) {
|
||||
if (value && value.length > 0 && value.trim()) {
|
||||
return value;
|
||||
}
|
||||
onError('!include without value');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Converts the tags from settings and adds known tags such as !include
|
||||
* and returns Tags that can be used by the parser.
|
||||
* @param customTags Tags for parser
|
||||
*/
|
||||
export function getCustomTags(customTags) {
|
||||
const tags = [];
|
||||
const filteredTags = filterInvalidCustomTags(customTags);
|
||||
for (const tag of filteredTags) {
|
||||
const typeInfo = tag.split(' ');
|
||||
const tagName = typeInfo[0];
|
||||
const tagType = (typeInfo[1] && typeInfo[1].toLowerCase()) || 'scalar';
|
||||
tags.push(new CommonTagImpl(tagName, tagType));
|
||||
}
|
||||
tags.push(new IncludeTag());
|
||||
return tags;
|
||||
}
|
||||
//# sourceMappingURL=custom-tag-provider.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"custom-tag-provider.js","sourceRoot":"","sources":["../../../../src/languageservice/parser/custom-tag-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,KAAK,EAAoB,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,aAAa;IAIjB,YAAY,GAAW,EAAE,IAAY;QACnC,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M,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC;QACvE,IAAI,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;KAChD;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
||||
4
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.d.ts
generated
vendored
4
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import * as Parser from './jsonParser07';
|
||||
export declare function setKubernetesParserOption(jsonDocuments: Parser.JSONDocument[], option: boolean): void;
|
||||
export declare function isKubernetesAssociatedDocument(textDocument: TextDocument, paths: string[]): boolean;
|
||||
17
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js
generated
vendored
17
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import { FilePatternAssociation } from '../services/yamlSchemaService';
|
||||
export function setKubernetesParserOption(jsonDocuments, option) {
|
||||
for (const jsonDoc of jsonDocuments) {
|
||||
jsonDoc.isKubernetes = option;
|
||||
}
|
||||
}
|
||||
export function isKubernetesAssociatedDocument(textDocument, paths) {
|
||||
for (const path in paths) {
|
||||
const globPath = paths[path];
|
||||
const fpa = new FilePatternAssociation(globPath);
|
||||
if (fpa.matchesPattern(textDocument.uri)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=isKubernetes.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"isKubernetes.js","sourceRoot":"","sources":["../../../../src/languageservice/parser/isKubernetes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,MAAM,UAAU,yBAAyB,CAAC,aAAoC,EAAE,MAAe;IAC7F,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE;QACnC,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;KAC/B;AACH,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,YAA0B,EAAE,KAAe;IACxF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,GAAG,GAAG,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAEjD,IAAI,GAAG,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
185
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.d.ts
generated
vendored
185
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.d.ts
generated
vendored
@@ -1,185 +0,0 @@
|
||||
import { JSONSchema, JSONSchemaRef } from '../jsonSchema';
|
||||
import { ASTNode, ObjectASTNode, ArrayASTNode, BooleanASTNode, NumberASTNode, StringASTNode, NullASTNode, PropertyASTNode, YamlNode } from '../jsonASTTypes';
|
||||
import { ErrorCode } from 'vscode-json-languageservice';
|
||||
import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Node, Pair } from 'yaml';
|
||||
export interface IRange {
|
||||
offset: number;
|
||||
length: number;
|
||||
}
|
||||
export declare const formats: {
|
||||
'color-hex': {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
'date-time': {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
date: {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
time: {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
email: {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
ipv4: {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
ipv6: {
|
||||
errorMessage: string;
|
||||
pattern: RegExp;
|
||||
};
|
||||
};
|
||||
export declare const YAML_SOURCE = "YAML";
|
||||
export declare enum ProblemType {
|
||||
missingRequiredPropWarning = "missingRequiredPropWarning",
|
||||
typeMismatchWarning = "typeMismatchWarning",
|
||||
constWarning = "constWarning"
|
||||
}
|
||||
export declare const ProblemTypeMessages: Record<ProblemType, string>;
|
||||
export interface IProblem {
|
||||
location: IRange;
|
||||
severity: DiagnosticSeverity;
|
||||
code?: ErrorCode;
|
||||
message: string;
|
||||
source?: string;
|
||||
problemType?: ProblemType;
|
||||
problemArgs?: string[];
|
||||
schemaUri?: string[];
|
||||
data?: Record<string, unknown>;
|
||||
}
|
||||
export declare abstract class ASTNodeImpl {
|
||||
abstract readonly type: 'object' | 'property' | 'array' | 'number' | 'boolean' | 'null' | 'string';
|
||||
offset: number;
|
||||
length: number;
|
||||
readonly parent: ASTNode;
|
||||
location: string;
|
||||
readonly internalNode: YamlNode;
|
||||
constructor(parent: ASTNode, internalNode: YamlNode, offset: number, length?: number);
|
||||
getNodeFromOffsetEndInclusive(offset: number): ASTNode;
|
||||
get children(): ASTNode[];
|
||||
toString(): string;
|
||||
}
|
||||
export declare class NullASTNodeImpl extends ASTNodeImpl implements NullASTNode {
|
||||
type: 'null';
|
||||
value: any;
|
||||
constructor(parent: ASTNode, internalNode: Node, offset: number, length?: number);
|
||||
}
|
||||
export declare class BooleanASTNodeImpl extends ASTNodeImpl implements BooleanASTNode {
|
||||
type: 'boolean';
|
||||
value: boolean;
|
||||
constructor(parent: ASTNode, internalNode: Node, boolValue: boolean, offset: number, length?: number);
|
||||
}
|
||||
export declare class ArrayASTNodeImpl extends ASTNodeImpl implements ArrayASTNode {
|
||||
type: 'array';
|
||||
items: ASTNode[];
|
||||
constructor(parent: ASTNode, internalNode: Node, offset: number, length?: number);
|
||||
get children(): ASTNode[];
|
||||
}
|
||||
export declare class NumberASTNodeImpl extends ASTNodeImpl implements NumberASTNode {
|
||||
type: 'number';
|
||||
isInteger: boolean;
|
||||
value: number;
|
||||
constructor(parent: ASTNode, internalNode: Node, offset: number, length?: number);
|
||||
}
|
||||
export declare class StringASTNodeImpl extends ASTNodeImpl implements StringASTNode {
|
||||
type: 'string';
|
||||
value: string;
|
||||
constructor(parent: ASTNode, internalNode: Node, offset: number, length?: number);
|
||||
}
|
||||
export declare class PropertyASTNodeImpl extends ASTNodeImpl implements PropertyASTNode {
|
||||
type: 'property';
|
||||
keyNode: StringASTNode;
|
||||
valueNode: ASTNode;
|
||||
colonOffset: number;
|
||||
constructor(parent: ObjectASTNode, internalNode: Pair, offset: number, length?: number);
|
||||
get children(): ASTNode[];
|
||||
}
|
||||
export declare class ObjectASTNodeImpl extends ASTNodeImpl implements ObjectASTNode {
|
||||
type: 'object';
|
||||
properties: PropertyASTNode[];
|
||||
constructor(parent: ASTNode, internalNode: Node, offset: number, length?: number);
|
||||
get children(): ASTNode[];
|
||||
}
|
||||
export declare function asSchema(schema: JSONSchemaRef): JSONSchema | undefined;
|
||||
export interface JSONDocumentConfig {
|
||||
collectComments?: boolean;
|
||||
}
|
||||
export interface IApplicableSchema {
|
||||
node: ASTNode;
|
||||
inverted?: boolean;
|
||||
schema: JSONSchema;
|
||||
}
|
||||
export declare enum EnumMatch {
|
||||
Key = 0,
|
||||
Enum = 1
|
||||
}
|
||||
export interface ISchemaCollector {
|
||||
schemas: IApplicableSchema[];
|
||||
add(schema: IApplicableSchema): void;
|
||||
merge(other: ISchemaCollector): void;
|
||||
include(node: ASTNode): boolean;
|
||||
newSub(): ISchemaCollector;
|
||||
}
|
||||
export declare class ValidationResult {
|
||||
problems: IProblem[];
|
||||
propertiesMatches: number;
|
||||
propertiesValueMatches: number;
|
||||
primaryValueMatches: number;
|
||||
enumValueMatch: boolean;
|
||||
enumValues: any[];
|
||||
constructor(isKubernetes: boolean);
|
||||
hasProblems(): boolean;
|
||||
mergeAll(validationResults: ValidationResult[]): void;
|
||||
merge(validationResult: ValidationResult): void;
|
||||
mergeEnumValues(validationResult: ValidationResult): void;
|
||||
/**
|
||||
* Merge multiple warnings with same problemType together
|
||||
* @param subValidationResult another possible result
|
||||
*/
|
||||
mergeWarningGeneric(subValidationResult: ValidationResult, problemTypesToMerge: ProblemType[]): void;
|
||||
mergePropertyMatch(propertyValidationResult: ValidationResult): void;
|
||||
private mergeSources;
|
||||
compareGeneric(other: ValidationResult): number;
|
||||
compareKubernetes(other: ValidationResult): number;
|
||||
}
|
||||
export declare function newJSONDocument(root: ASTNode, diagnostics?: Diagnostic[]): JSONDocument;
|
||||
export declare function getNodeValue(node: ASTNode): any;
|
||||
export declare function contains(node: ASTNode, offset: number, includeRightBound?: boolean): boolean;
|
||||
export declare function findNodeAtOffset(node: ASTNode, offset: number, includeRightBound: boolean): ASTNode;
|
||||
export declare class JSONDocument {
|
||||
readonly root: ASTNode;
|
||||
readonly syntaxErrors: Diagnostic[];
|
||||
readonly comments: Range[];
|
||||
isKubernetes: boolean;
|
||||
disableAdditionalProperties: boolean;
|
||||
uri: string;
|
||||
constructor(root: ASTNode, syntaxErrors?: Diagnostic[], comments?: Range[]);
|
||||
getNodeFromOffset(offset: number, includeRightBound?: boolean): ASTNode | undefined;
|
||||
getNodeFromOffsetEndInclusive(offset: number): ASTNode;
|
||||
visit(visitor: (node: ASTNode) => boolean): void;
|
||||
validate(textDocument: TextDocument, schema: JSONSchema): Diagnostic[];
|
||||
/**
|
||||
* This method returns the list of applicable schemas
|
||||
*
|
||||
* currently used @param didCallFromAutoComplete flag to differentiate the method call, when it is from auto complete
|
||||
* then user still types something and skip the validation for timebeing untill completed.
|
||||
* On https://github.com/redhat-developer/yaml-language-server/pull/719 the auto completes need to populate the list of enum string which matches to the enum
|
||||
* and on https://github.com/redhat-developer/vscode-yaml/issues/803 the validation should throw the error based on the enum string.
|
||||
*
|
||||
* @param schema schema
|
||||
* @param focusOffset offsetValue
|
||||
* @param exclude excluded Node
|
||||
* @param didCallFromAutoComplete true if method called from AutoComplete
|
||||
* @returns array of applicable schemas
|
||||
*/
|
||||
getMatchingSchemas(schema: JSONSchema, focusOffset?: number, exclude?: ASTNode, didCallFromAutoComplete?: boolean): IApplicableSchema[];
|
||||
}
|
||||
1332
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js
generated
vendored
1332
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.d.ts
generated
vendored
8
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.d.ts
generated
vendored
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Parse a boolean according to the specification
|
||||
*
|
||||
* Return:
|
||||
* true if its a true value
|
||||
* false if its a false value
|
||||
*/
|
||||
export declare function parseYamlBoolean(input: string): boolean;
|
||||
17
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js
generated
vendored
17
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Parse a boolean according to the specification
|
||||
*
|
||||
* Return:
|
||||
* true if its a true value
|
||||
* false if its a false value
|
||||
*/
|
||||
export function parseYamlBoolean(input) {
|
||||
if (['true', 'True', 'TRUE', 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON'].lastIndexOf(input) >= 0) {
|
||||
return true;
|
||||
}
|
||||
else if (['false', 'False', 'FALSE', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'].lastIndexOf(input) >= 0) {
|
||||
return false;
|
||||
}
|
||||
throw `Invalid boolean "${input}"`;
|
||||
}
|
||||
//# sourceMappingURL=scalar-type.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"scalar-type.js","sourceRoot":"","sources":["../../../../src/languageservice/parser/scalar-type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACrG,OAAO,IAAI,CAAC;KACb;SAAM,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAC/G,OAAO,KAAK,CAAC;KACd;IACD,MAAM,oBAAoB,KAAK,GAAG,CAAC;AACrC,CAAC"}
|
||||
71
node_modules/yaml-language-server/lib/esm/languageservice/parser/yaml-documents.d.ts
generated
vendored
71
node_modules/yaml-language-server/lib/esm/languageservice/parser/yaml-documents.d.ts
generated
vendored
@@ -1,71 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { JSONDocument } from './jsonParser07';
|
||||
import { Document, LineCounter } from 'yaml';
|
||||
import { ASTNode, YamlNode } from '../jsonASTTypes';
|
||||
import { ParserOptions } from './yamlParser07';
|
||||
import { YAMLDocDiagnostic } from '../utils/parseUtils';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
import { Token } from 'yaml/dist/parse/cst';
|
||||
/**
|
||||
* These documents are collected into a final YAMLDocument
|
||||
* and passed to the `parseYAML` caller.
|
||||
*/
|
||||
export declare class SingleYAMLDocument extends JSONDocument {
|
||||
private lineCounter;
|
||||
private _internalDocument;
|
||||
root: ASTNode;
|
||||
currentDocIndex: number;
|
||||
private _lineComments;
|
||||
constructor(lineCounter?: LineCounter);
|
||||
/**
|
||||
* Create a deep copy of this document
|
||||
*/
|
||||
clone(): SingleYAMLDocument;
|
||||
private collectLineComments;
|
||||
/**
|
||||
* Updates the internal AST tree of the object
|
||||
* from the internal node. This is call whenever the
|
||||
* internalDocument is set but also can be called to
|
||||
* reflect any changes on the underlying document
|
||||
* without setting the internalDocument explicitly.
|
||||
*/
|
||||
updateFromInternalDocument(): void;
|
||||
set internalDocument(document: Document);
|
||||
get internalDocument(): Document;
|
||||
get lineComments(): string[];
|
||||
set lineComments(val: string[]);
|
||||
get errors(): YAMLDocDiagnostic[];
|
||||
get warnings(): YAMLDocDiagnostic[];
|
||||
getNodeFromPosition(positionOffset: number, textBuffer: TextBuffer, configuredIndentation?: number): [YamlNode | undefined, boolean];
|
||||
findClosestNode(offset: number, textBuffer: TextBuffer, configuredIndentation?: number): YamlNode;
|
||||
private getProperParentByIndentation;
|
||||
getParent(node: YamlNode): YamlNode | undefined;
|
||||
}
|
||||
/**
|
||||
* Contains the SingleYAMLDocuments, to be passed
|
||||
* to the `parseYAML` caller.
|
||||
*/
|
||||
export declare class YAMLDocument {
|
||||
documents: SingleYAMLDocument[];
|
||||
tokens: Token[];
|
||||
private errors;
|
||||
private warnings;
|
||||
constructor(documents: SingleYAMLDocument[], tokens: Token[]);
|
||||
}
|
||||
export declare class YamlDocuments {
|
||||
private cache;
|
||||
/**
|
||||
* Get cached YAMLDocument
|
||||
* @param document TextDocument to parse
|
||||
* @param parserOptions YAML parserOptions
|
||||
* @param addRootObject if true and document is empty add empty object {} to force schema usage
|
||||
* @returns the YAMLDocument
|
||||
*/
|
||||
getYamlDocument(document: TextDocument, parserOptions?: ParserOptions, addRootObject?: boolean): YAMLDocument;
|
||||
/**
|
||||
* For test purpose only!
|
||||
*/
|
||||
clear(): void;
|
||||
private ensureCache;
|
||||
}
|
||||
export declare const yamlDocumentsCache: YamlDocuments;
|
||||
258
node_modules/yaml-language-server/lib/esm/languageservice/parser/yaml-documents.js
generated
vendored
258
node_modules/yaml-language-server/lib/esm/languageservice/parser/yaml-documents.js
generated
vendored
@@ -1,258 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { JSONDocument } from './jsonParser07';
|
||||
import { isNode, isPair, isScalar, visit } from 'yaml';
|
||||
import { defaultOptions, parse as parseYAML } from './yamlParser07';
|
||||
import { ErrorCode } from 'vscode-json-languageservice';
|
||||
import { convertAST } from './ast-converter';
|
||||
import { isArrayEqual } from '../utils/arrUtils';
|
||||
import { getParent } from '../utils/astUtils';
|
||||
import { getIndentation } from '../utils/strings';
|
||||
/**
|
||||
* These documents are collected into a final YAMLDocument
|
||||
* and passed to the `parseYAML` caller.
|
||||
*/
|
||||
export class SingleYAMLDocument extends JSONDocument {
|
||||
constructor(lineCounter) {
|
||||
super(null, []);
|
||||
this.lineCounter = lineCounter;
|
||||
}
|
||||
/**
|
||||
* Create a deep copy of this document
|
||||
*/
|
||||
clone() {
|
||||
const copy = new SingleYAMLDocument(this.lineCounter);
|
||||
copy.isKubernetes = this.isKubernetes;
|
||||
copy.disableAdditionalProperties = this.disableAdditionalProperties;
|
||||
copy.uri = this.uri;
|
||||
copy.currentDocIndex = this.currentDocIndex;
|
||||
copy._lineComments = this.lineComments.slice();
|
||||
// this will re-create root node
|
||||
copy.internalDocument = this._internalDocument.clone();
|
||||
return copy;
|
||||
}
|
||||
collectLineComments() {
|
||||
this._lineComments = [];
|
||||
if (this._internalDocument.commentBefore) {
|
||||
const comments = this._internalDocument.commentBefore.split('\n');
|
||||
comments.forEach((comment) => this._lineComments.push(`#${comment}`));
|
||||
}
|
||||
visit(this.internalDocument, (_key, node) => {
|
||||
if (node?.commentBefore) {
|
||||
const comments = node?.commentBefore.split('\n');
|
||||
comments.forEach((comment) => this._lineComments.push(`#${comment}`));
|
||||
}
|
||||
if (node?.comment) {
|
||||
this._lineComments.push(`#${node.comment}`);
|
||||
}
|
||||
});
|
||||
if (this._internalDocument.comment) {
|
||||
this._lineComments.push(`#${this._internalDocument.comment}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Updates the internal AST tree of the object
|
||||
* from the internal node. This is call whenever the
|
||||
* internalDocument is set but also can be called to
|
||||
* reflect any changes on the underlying document
|
||||
* without setting the internalDocument explicitly.
|
||||
*/
|
||||
updateFromInternalDocument() {
|
||||
this.root = convertAST(null, this._internalDocument.contents, this._internalDocument, this.lineCounter);
|
||||
}
|
||||
set internalDocument(document) {
|
||||
this._internalDocument = document;
|
||||
this.updateFromInternalDocument();
|
||||
}
|
||||
get internalDocument() {
|
||||
return this._internalDocument;
|
||||
}
|
||||
get lineComments() {
|
||||
if (!this._lineComments) {
|
||||
this.collectLineComments();
|
||||
}
|
||||
return this._lineComments;
|
||||
}
|
||||
set lineComments(val) {
|
||||
this._lineComments = val;
|
||||
}
|
||||
get errors() {
|
||||
return this.internalDocument.errors.map(YAMLErrorToYamlDocDiagnostics);
|
||||
}
|
||||
get warnings() {
|
||||
return this.internalDocument.warnings.map(YAMLErrorToYamlDocDiagnostics);
|
||||
}
|
||||
getNodeFromPosition(positionOffset, textBuffer, configuredIndentation) {
|
||||
const position = textBuffer.getPosition(positionOffset);
|
||||
const lineContent = textBuffer.getLineContent(position.line);
|
||||
if (lineContent.trim().length === 0) {
|
||||
return [this.findClosestNode(positionOffset, textBuffer, configuredIndentation), true];
|
||||
}
|
||||
const textAfterPosition = lineContent.substring(position.character);
|
||||
const spacesAfterPositionMatch = textAfterPosition.match(/^([ ]+)\n?$/);
|
||||
const areOnlySpacesAfterPosition = !!spacesAfterPositionMatch;
|
||||
const countOfSpacesAfterPosition = spacesAfterPositionMatch?.[1].length;
|
||||
let closestNode;
|
||||
visit(this.internalDocument, (key, node) => {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
const range = node.range;
|
||||
if (!range) {
|
||||
return;
|
||||
}
|
||||
const isNullNodeOnTheLine = () => areOnlySpacesAfterPosition &&
|
||||
positionOffset + countOfSpacesAfterPosition === range[2] &&
|
||||
isScalar(node) &&
|
||||
node.value === null;
|
||||
if ((range[0] <= positionOffset && range[1] >= positionOffset) || isNullNodeOnTheLine()) {
|
||||
closestNode = node;
|
||||
}
|
||||
else {
|
||||
return visit.SKIP;
|
||||
}
|
||||
});
|
||||
return [closestNode, false];
|
||||
}
|
||||
findClosestNode(offset, textBuffer, configuredIndentation) {
|
||||
let offsetDiff = this.internalDocument.range[2];
|
||||
let maxOffset = this.internalDocument.range[0];
|
||||
let closestNode;
|
||||
visit(this.internalDocument, (key, node) => {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
const range = node.range;
|
||||
if (!range) {
|
||||
return;
|
||||
}
|
||||
const diff = range[1] - offset;
|
||||
if (maxOffset <= range[0] && diff <= 0 && Math.abs(diff) <= offsetDiff) {
|
||||
offsetDiff = Math.abs(diff);
|
||||
maxOffset = range[0];
|
||||
closestNode = node;
|
||||
}
|
||||
});
|
||||
const position = textBuffer.getPosition(offset);
|
||||
const lineContent = textBuffer.getLineContent(position.line);
|
||||
const indentation = getIndentation(lineContent, position.character);
|
||||
if (isScalar(closestNode) && closestNode.value === null) {
|
||||
return closestNode;
|
||||
}
|
||||
if (indentation === position.character) {
|
||||
closestNode = this.getProperParentByIndentation(indentation, closestNode, textBuffer, '', configuredIndentation);
|
||||
}
|
||||
return closestNode;
|
||||
}
|
||||
getProperParentByIndentation(indentation, node, textBuffer, currentLine, configuredIndentation, rootParent) {
|
||||
if (!node) {
|
||||
return this.internalDocument.contents;
|
||||
}
|
||||
configuredIndentation = !configuredIndentation ? 2 : configuredIndentation;
|
||||
if (isNode(node) && node.range) {
|
||||
const position = textBuffer.getPosition(node.range[0]);
|
||||
const lineContent = textBuffer.getLineContent(position.line);
|
||||
currentLine = currentLine === '' ? lineContent.trim() : currentLine;
|
||||
if (currentLine.startsWith('-') && indentation === configuredIndentation && currentLine === lineContent.trim()) {
|
||||
position.character += indentation;
|
||||
}
|
||||
if (position.character > indentation && position.character > 0) {
|
||||
const parent = this.getParent(node);
|
||||
if (parent) {
|
||||
return this.getProperParentByIndentation(indentation, parent, textBuffer, currentLine, configuredIndentation, rootParent);
|
||||
}
|
||||
}
|
||||
else if (position.character < indentation) {
|
||||
const parent = this.getParent(node);
|
||||
if (isPair(parent) && isNode(parent.value)) {
|
||||
return parent.value;
|
||||
}
|
||||
else if (isPair(rootParent) && isNode(rootParent.value)) {
|
||||
return rootParent.value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
else if (isPair(node)) {
|
||||
rootParent = node;
|
||||
const parent = this.getParent(node);
|
||||
return this.getProperParentByIndentation(indentation, parent, textBuffer, currentLine, configuredIndentation, rootParent);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
getParent(node) {
|
||||
return getParent(this.internalDocument, node);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Contains the SingleYAMLDocuments, to be passed
|
||||
* to the `parseYAML` caller.
|
||||
*/
|
||||
export class YAMLDocument {
|
||||
constructor(documents, tokens) {
|
||||
this.documents = documents;
|
||||
this.tokens = tokens;
|
||||
this.errors = [];
|
||||
this.warnings = [];
|
||||
}
|
||||
}
|
||||
export class YamlDocuments {
|
||||
constructor() {
|
||||
// a mapping of URIs to cached documents
|
||||
this.cache = new Map();
|
||||
}
|
||||
/**
|
||||
* Get cached YAMLDocument
|
||||
* @param document TextDocument to parse
|
||||
* @param parserOptions YAML parserOptions
|
||||
* @param addRootObject if true and document is empty add empty object {} to force schema usage
|
||||
* @returns the YAMLDocument
|
||||
*/
|
||||
getYamlDocument(document, parserOptions, addRootObject = false) {
|
||||
this.ensureCache(document, parserOptions ?? defaultOptions, addRootObject);
|
||||
return this.cache.get(document.uri).document;
|
||||
}
|
||||
/**
|
||||
* For test purpose only!
|
||||
*/
|
||||
clear() {
|
||||
this.cache.clear();
|
||||
}
|
||||
ensureCache(document, parserOptions, addRootObject) {
|
||||
const key = document.uri;
|
||||
if (!this.cache.has(key)) {
|
||||
this.cache.set(key, { version: -1, document: new YAMLDocument([], []), parserOptions: defaultOptions });
|
||||
}
|
||||
const cacheEntry = this.cache.get(key);
|
||||
if (cacheEntry.version !== document.version ||
|
||||
(parserOptions.customTags && !isArrayEqual(cacheEntry.parserOptions.customTags, parserOptions.customTags))) {
|
||||
let text = document.getText();
|
||||
// if text is contains only whitespace wrap all text in object to force schema selection
|
||||
if (addRootObject && !/\S/.test(text)) {
|
||||
text = `{${text}}`;
|
||||
}
|
||||
const doc = parseYAML(text, parserOptions, document);
|
||||
cacheEntry.document = doc;
|
||||
cacheEntry.version = document.version;
|
||||
cacheEntry.parserOptions = parserOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
export const yamlDocumentsCache = new YamlDocuments();
|
||||
function YAMLErrorToYamlDocDiagnostics(error) {
|
||||
return {
|
||||
message: error.message,
|
||||
location: {
|
||||
start: error.pos[0],
|
||||
end: error.pos[1],
|
||||
toLineEnd: true,
|
||||
},
|
||||
severity: 1,
|
||||
code: ErrorCode.Undefined,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=yaml-documents.js.map
|
||||
File diff suppressed because one or more lines are too long
15
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.d.ts
generated
vendored
15
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.d.ts
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import { YAMLDocument, SingleYAMLDocument } from './yaml-documents';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export { YAMLDocument, SingleYAMLDocument };
|
||||
export declare type YamlVersion = '1.1' | '1.2';
|
||||
export interface ParserOptions {
|
||||
customTags: string[];
|
||||
yamlVersion: YamlVersion;
|
||||
}
|
||||
export declare const defaultOptions: ParserOptions;
|
||||
/**
|
||||
* `yaml-ast-parser-custom-tags` parses the AST and
|
||||
* returns YAML AST nodes, which are then formatted
|
||||
* for consumption via the language server.
|
||||
*/
|
||||
export declare function parse(text: string, parserOptions?: ParserOptions, document?: TextDocument): YAMLDocument;
|
||||
50
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js
generated
vendored
50
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Adam Voss. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Parser, Composer, LineCounter } from 'yaml';
|
||||
import { YAMLDocument, SingleYAMLDocument } from './yaml-documents';
|
||||
import { getCustomTags } from './custom-tag-provider';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
export { YAMLDocument, SingleYAMLDocument };
|
||||
export const defaultOptions = {
|
||||
customTags: [],
|
||||
yamlVersion: '1.2',
|
||||
};
|
||||
/**
|
||||
* `yaml-ast-parser-custom-tags` parses the AST and
|
||||
* returns YAML AST nodes, which are then formatted
|
||||
* for consumption via the language server.
|
||||
*/
|
||||
export function parse(text, parserOptions = defaultOptions, document) {
|
||||
const options = {
|
||||
strict: false,
|
||||
customTags: getCustomTags(parserOptions.customTags),
|
||||
version: parserOptions.yamlVersion ?? defaultOptions.yamlVersion,
|
||||
keepSourceTokens: true,
|
||||
};
|
||||
const composer = new Composer(options);
|
||||
const lineCounter = new LineCounter();
|
||||
let isLastLineEmpty = false;
|
||||
if (document) {
|
||||
const textBuffer = new TextBuffer(document);
|
||||
const position = textBuffer.getPosition(text.length);
|
||||
const lineContent = textBuffer.getLineContent(position.line);
|
||||
isLastLineEmpty = lineContent.trim().length === 0;
|
||||
}
|
||||
const parser = isLastLineEmpty ? new Parser() : new Parser(lineCounter.addNewLine);
|
||||
const tokens = parser.parse(text);
|
||||
const tokensArr = Array.from(tokens);
|
||||
const docs = composer.compose(tokensArr, true, text.length);
|
||||
// Generate the SingleYAMLDocs from the AST nodes
|
||||
const yamlDocs = Array.from(docs, (doc) => parsedDocToSingleYAMLDocument(doc, lineCounter));
|
||||
// Consolidate the SingleYAMLDocs
|
||||
return new YAMLDocument(yamlDocs, tokensArr);
|
||||
}
|
||||
function parsedDocToSingleYAMLDocument(parsedDoc, lineCounter) {
|
||||
const syd = new SingleYAMLDocument(lineCounter);
|
||||
syd.internalDocument = parsedDoc;
|
||||
return syd;
|
||||
}
|
||||
//# sourceMappingURL=yamlParser07.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/parser/yamlParser07.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlParser07.js","sourceRoot":"","sources":["../../../../src/languageservice/parser/yamlParser07.ts"],"names":[],"mappings":"AAAA;;;;gGAIgG;AAEhG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAY,WAAW,EAAgD,MAAM,MAAM,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,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CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,iDAAiD;IACjD,MAAM,QAAQ,GAAyB,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,6BAA6B,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;IAElH,iCAAiC;IACjC,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,6BAA6B,CAAC,SAAmB,EAAE,WAAwB;IAClF,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,GAAG,CAAC,gBAAgB,GAAG,SAAS,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
||||
12
node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.d.ts
generated
vendored
12
node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.d.ts
generated
vendored
@@ -1,12 +0,0 @@
|
||||
import { SymbolInformation, DocumentSymbol } from 'vscode-languageserver-types';
|
||||
import { YAMLSchemaService } from './yamlSchemaService';
|
||||
import { DocumentSymbolsContext } from 'vscode-json-languageservice/lib/umd/jsonLanguageTypes';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Telemetry } from '../telemetry';
|
||||
export declare class YAMLDocumentSymbols {
|
||||
private readonly telemetry?;
|
||||
private jsonDocumentSymbols;
|
||||
constructor(schemaService: YAMLSchemaService, telemetry?: Telemetry);
|
||||
findDocumentSymbols(document: TextDocument, context?: DocumentSymbolsContext): SymbolInformation[];
|
||||
findHierarchicalDocumentSymbols(document: TextDocument, context?: DocumentSymbolsContext): DocumentSymbol[];
|
||||
}
|
||||
68
node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.js
generated
vendored
68
node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { JSONDocumentSymbols } from 'vscode-json-languageservice/lib/umd/services/jsonDocumentSymbols';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { isMap, isSeq } from 'yaml';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
export class YAMLDocumentSymbols {
|
||||
constructor(schemaService, telemetry) {
|
||||
this.telemetry = telemetry;
|
||||
this.jsonDocumentSymbols = new JSONDocumentSymbols(schemaService);
|
||||
// override 'getKeyLabel' to handle complex mapping
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
this.jsonDocumentSymbols.getKeyLabel = (property) => {
|
||||
const keyNode = property.keyNode.internalNode;
|
||||
let name = '';
|
||||
if (isMap(keyNode)) {
|
||||
name = '{}';
|
||||
}
|
||||
else if (isSeq(keyNode)) {
|
||||
name = '[]';
|
||||
}
|
||||
else {
|
||||
name = keyNode.source;
|
||||
}
|
||||
return name;
|
||||
};
|
||||
}
|
||||
findDocumentSymbols(document, context = { resultLimit: Number.MAX_VALUE }) {
|
||||
let results = [];
|
||||
try {
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
if (!doc || doc['documents'].length === 0) {
|
||||
return null;
|
||||
}
|
||||
for (const yamlDoc of doc['documents']) {
|
||||
if (yamlDoc.root) {
|
||||
results = results.concat(this.jsonDocumentSymbols.findDocumentSymbols(document, yamlDoc, context));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.documentSymbols.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
return results;
|
||||
}
|
||||
findHierarchicalDocumentSymbols(document, context = { resultLimit: Number.MAX_VALUE }) {
|
||||
let results = [];
|
||||
try {
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
if (!doc || doc['documents'].length === 0) {
|
||||
return null;
|
||||
}
|
||||
for (const yamlDoc of doc['documents']) {
|
||||
if (yamlDoc.root) {
|
||||
results = results.concat(this.jsonDocumentSymbols.findDocumentSymbols2(document, yamlDoc, context));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.hierarchicalDocumentSymbols.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=documentSymbols.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"documentSymbols.js","sourceRoot":"","sources":["../../../../src/languageservice/services/documentSymbols.ts"],"names":[],"mappings":"AAAA;;;;gGAIgG;AAIhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AAGvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAQ,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,OAAO,mBAAmB;IAG9B,YAAY,aAAgC,EAAmB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QAClF,IAAI,CAAC,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC;QAElE,mDAAmD;QACnD,8DAA8D;QAC9D,IAAI,CAAC,mBAAmB,CAAC,WAAW,GAAG,CAAC,QAAa,EAAE,EAAE;YACvD,MAAM,OAAO,GAAS,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC;YACpD,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;gBAClB,IAAI,GAAG,IAAI,CAAC;aACb;iBAAM,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AC;aACb;YAED,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE;gBACtC,IAAI,OAAO,CAAC,IAAI,EAAE;oBAChB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;iBACrG;aACF;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,wCAAwC,EAAE,EAAE,KAAK,EAAE,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACjH;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
||||
9
node_modules/yaml-language-server/lib/esm/languageservice/services/modelineUtil.d.ts
generated
vendored
9
node_modules/yaml-language-server/lib/esm/languageservice/services/modelineUtil.d.ts
generated
vendored
@@ -1,9 +0,0 @@
|
||||
import { SingleYAMLDocument } from '../parser/yamlParser07';
|
||||
import { JSONDocument } from '../parser/jsonParser07';
|
||||
/**
|
||||
* Retrieve schema if declared as modeline.
|
||||
* Public for testing purpose, not part of the API.
|
||||
* @param doc
|
||||
*/
|
||||
export declare function getSchemaFromModeline(doc: SingleYAMLDocument | JSONDocument): string;
|
||||
export declare function isModeline(lineText: string): boolean;
|
||||
32
node_modules/yaml-language-server/lib/esm/languageservice/services/modelineUtil.js
generated
vendored
32
node_modules/yaml-language-server/lib/esm/languageservice/services/modelineUtil.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { SingleYAMLDocument } from '../parser/yamlParser07';
|
||||
/**
|
||||
* Retrieve schema if declared as modeline.
|
||||
* Public for testing purpose, not part of the API.
|
||||
* @param doc
|
||||
*/
|
||||
export function getSchemaFromModeline(doc) {
|
||||
if (doc instanceof SingleYAMLDocument) {
|
||||
const yamlLanguageServerModeline = doc.lineComments.find((lineComment) => {
|
||||
return isModeline(lineComment);
|
||||
});
|
||||
if (yamlLanguageServerModeline != undefined) {
|
||||
const schemaMatchs = yamlLanguageServerModeline.match(/\$schema=\S+/g);
|
||||
if (schemaMatchs !== null && schemaMatchs.length >= 1) {
|
||||
if (schemaMatchs.length >= 2) {
|
||||
console.log('Several $schema attributes have been found on the yaml-language-server modeline. The first one will be picked.');
|
||||
}
|
||||
return schemaMatchs[0].substring('$schema='.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export function isModeline(lineText) {
|
||||
const matchModeline = lineText.match(/^#\s+yaml-language-server\s*:/g);
|
||||
return matchModeline !== null && matchModeline.length === 1;
|
||||
}
|
||||
//# sourceMappingURL=modelineUtil.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"modelineUtil.js","sourceRoot":"","sources":["../../../../src/languageservice/services/modelineUtil.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAsC;IAC1E,IAAI,GAAG,YAAY,kBAAkB,EAAE;QACrC,MAAM,0BAA0B,GAAG,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;YACvE,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,IAAI,0BAA0B,IAAI,SAAS,EAAE;YAC3C,MAAM,YAAY,GAAG,0BAA0B,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YACvE,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE;gBACrD,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC5B,OAAO,CAAC,GAAG,CACT,gHAAgH,CACjH,CAAC;iBACH;gBACD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aACrD;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACvE,OAAO,aAAa,KAAK,IAAI,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
||||
@@ -1,12 +0,0 @@
|
||||
import { URI } from 'vscode-uri';
|
||||
import { Connection, WorkspaceFolder } from 'vscode-languageserver';
|
||||
import { WorkspaceContextService } from '../yamlLanguageService';
|
||||
export interface FileSystem {
|
||||
readFile(fsPath: string, encoding?: string): Promise<string>;
|
||||
}
|
||||
/**
|
||||
* Handles schema content requests given the schema URI
|
||||
* @param uri can be a local file, vscode request, http(s) request or a custom request
|
||||
*/
|
||||
export declare const schemaRequestHandler: (connection: Connection, uri: string, workspaceFolders: WorkspaceFolder[], workspaceRoot: URI, useVSCodeContentRequest: boolean, fs: FileSystem) => Promise<string>;
|
||||
export declare const workspaceContext: WorkspaceContextService;
|
||||
@@ -1,62 +0,0 @@
|
||||
import { URI } from 'vscode-uri';
|
||||
import { xhr, getErrorStatusDescription } from 'request-light';
|
||||
import * as URL from 'url';
|
||||
import { CustomSchemaContentRequest, VSCodeContentRequest } from '../../requestTypes';
|
||||
import { isRelativePath, relativeToAbsolutePath } from '../utils/paths';
|
||||
/**
|
||||
* Handles schema content requests given the schema URI
|
||||
* @param uri can be a local file, vscode request, http(s) request or a custom request
|
||||
*/
|
||||
export const schemaRequestHandler = (connection, uri, workspaceFolders, workspaceRoot, useVSCodeContentRequest, fs) => {
|
||||
if (!uri) {
|
||||
return Promise.reject('No schema specified');
|
||||
}
|
||||
// If the requested schema URI is a relative file path
|
||||
// Convert it into a proper absolute path URI
|
||||
if (isRelativePath(uri)) {
|
||||
uri = relativeToAbsolutePath(workspaceFolders, workspaceRoot, uri);
|
||||
}
|
||||
let scheme = URI.parse(uri).scheme.toLowerCase();
|
||||
// test if uri is windows path, ie starts with 'c:\'
|
||||
if (/^[a-z]:[\\/]/i.test(uri)) {
|
||||
const winUri = URI.file(uri);
|
||||
scheme = winUri.scheme.toLowerCase();
|
||||
uri = winUri.toString();
|
||||
}
|
||||
// If the requested schema is a local file, read and return the file contents
|
||||
if (scheme === 'file') {
|
||||
const fsPath = URI.parse(uri).fsPath;
|
||||
return fs.readFile(fsPath, 'UTF-8').catch(() => {
|
||||
// If there was an error reading the file, return empty error message
|
||||
// Otherwise return the file contents as a string
|
||||
return '';
|
||||
});
|
||||
}
|
||||
// HTTP(S) requests are sent and the response result is either the schema content or an error
|
||||
if (scheme === 'http' || scheme === 'https') {
|
||||
// If we are running inside of VSCode we need to make a content request. This content request
|
||||
// will make it so that schemas behind VPN's will resolve correctly
|
||||
if (useVSCodeContentRequest) {
|
||||
return connection.sendRequest(VSCodeContentRequest.type, uri).then((responseText) => {
|
||||
return responseText;
|
||||
}, (error) => {
|
||||
return Promise.reject(error.message);
|
||||
});
|
||||
}
|
||||
// Send the HTTP(S) schema content request and return the result
|
||||
const headers = { 'Accept-Encoding': 'gzip, deflate' };
|
||||
return xhr({ url: uri, followRedirects: 5, headers }).then((response) => {
|
||||
return response.responseText;
|
||||
}, (error) => {
|
||||
return Promise.reject(error.responseText || getErrorStatusDescription(error.status) || error.toString());
|
||||
});
|
||||
}
|
||||
// Neither local file nor vscode, nor HTTP(S) schema request, so send it off as a custom request
|
||||
return connection.sendRequest(CustomSchemaContentRequest.type, uri);
|
||||
};
|
||||
export const workspaceContext = {
|
||||
resolveRelativePath: (relativePath, resource) => {
|
||||
return URL.resolve(resource, relativePath);
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=schemaRequestHandler.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"schemaRequest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AAE,QAAgB,EAAE,EAAE;QAC9D,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC"}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Diagnostic } from 'vscode-languageserver-types';
|
||||
import { SingleYAMLDocument } from '../../parser/yaml-documents';
|
||||
import { AdditionalValidator } from './types';
|
||||
export declare class MapKeyOrderValidator implements AdditionalValidator {
|
||||
validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[];
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types';
|
||||
import { isMap, visit } from 'yaml';
|
||||
export class MapKeyOrderValidator {
|
||||
validate(document, yamlDoc) {
|
||||
const result = [];
|
||||
visit(yamlDoc.internalDocument, (key, node) => {
|
||||
if (isMap(node)) {
|
||||
for (let i = 1; i < node.items.length; i++) {
|
||||
if (compare(node.items[i - 1], node.items[i]) > 0) {
|
||||
const range = createRange(document, node.items[i - 1]);
|
||||
result.push(Diagnostic.create(range, `Wrong ordering of key "${node.items[i - 1].key}" in mapping`, DiagnosticSeverity.Error, 'mapKeyOrder'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
function createRange(document, node) {
|
||||
const start = node?.srcToken.start[0]?.offset ?? node?.srcToken?.key.offset ?? node?.srcToken?.sep[0]?.offset;
|
||||
const end = node?.srcToken?.value.offset ||
|
||||
node?.srcToken?.sep[0]?.offset ||
|
||||
node?.srcToken?.key.offset ||
|
||||
node?.srcToken.start[node.srcToken.start.length - 1]?.offset;
|
||||
return Range.create(document.positionAt(start), document.positionAt(end));
|
||||
}
|
||||
function compare(thiz, that) {
|
||||
const thatKey = String(that.key);
|
||||
const thisKey = String(thiz.key);
|
||||
return thisKey.localeCompare(thatKey);
|
||||
}
|
||||
//# sourceMappingURL=map-key-order.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"map-key-order.js","sourceRoot":"","sources":["../../../../../src/languageservice/services/validation/map-key-order.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGpF,OAAO,EAAE,KAAK,EAAQ,KAAK,EAAE,MAAM,MAAM,CAAC;AAE1C,MAAM,OAAO,oBAAoB;IAC/B,QAAQ,CAAC,QAAsB,EAAE,OAA2B;QAC1D,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAC5C,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;gBACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;wBACjD,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBACvD,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,MAAM,CACf,KAAK,EACL,0BAA0B,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,cAAc,EAC7D,kBAAkB,CAAC,KAAK,EACxB,aAAa,CACd,CACF,CAAC;qBACH;iBACF;aACF;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,SAAS,WAAW,CAAC,QAAsB,EAAE,IAAU;IACrD,MAAM,KAAK,GAAG,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAC9G,MAAM,GAAG,GACP,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM;QAC5B,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM;QAC9B,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM;QAC1B,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC;IAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,OAAO,CAAC,IAAU,EAAE,IAAU;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Diagnostic } from 'vscode-languageserver-types';
|
||||
import { SingleYAMLDocument } from '../../parser/yaml-documents';
|
||||
export interface AdditionalValidator {
|
||||
validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[];
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/languageservice/services/validation/types.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Diagnostic } from 'vscode-languageserver-types';
|
||||
import { SingleYAMLDocument } from '../../parser/yaml-documents';
|
||||
import { AdditionalValidator } from './types';
|
||||
export declare class UnusedAnchorsValidator implements AdditionalValidator {
|
||||
validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[];
|
||||
private getAnchorNode;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Diagnostic, DiagnosticSeverity, DiagnosticTag, Range } from 'vscode-languageserver-types';
|
||||
import { isAlias, isCollection, isNode, isScalar, visit, CST } from 'yaml';
|
||||
import { isCollectionItem } from '../../../languageservice/utils/astUtils';
|
||||
export class UnusedAnchorsValidator {
|
||||
validate(document, yamlDoc) {
|
||||
const result = [];
|
||||
const anchors = new Set();
|
||||
const usedAnchors = new Set();
|
||||
const anchorParent = new Map();
|
||||
visit(yamlDoc.internalDocument, (key, node, path) => {
|
||||
if (!isNode(node)) {
|
||||
return;
|
||||
}
|
||||
if ((isCollection(node) || isScalar(node)) && node.anchor) {
|
||||
anchors.add(node);
|
||||
anchorParent.set(node, path[path.length - 1]);
|
||||
}
|
||||
if (isAlias(node)) {
|
||||
usedAnchors.add(node.resolve(yamlDoc.internalDocument));
|
||||
}
|
||||
});
|
||||
for (const anchor of anchors) {
|
||||
if (!usedAnchors.has(anchor)) {
|
||||
const aToken = this.getAnchorNode(anchorParent.get(anchor), anchor);
|
||||
if (aToken) {
|
||||
const range = Range.create(document.positionAt(aToken.offset), document.positionAt(aToken.offset + aToken.source.length));
|
||||
const warningDiagnostic = Diagnostic.create(range, `Unused anchor "${aToken.source}"`, DiagnosticSeverity.Hint, 0);
|
||||
warningDiagnostic.tags = [DiagnosticTag.Unnecessary];
|
||||
result.push(warningDiagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getAnchorNode(parentNode, node) {
|
||||
if (parentNode && parentNode.srcToken) {
|
||||
const token = parentNode.srcToken;
|
||||
if (isCollectionItem(token)) {
|
||||
return getAnchorFromCollectionItem(token);
|
||||
}
|
||||
else if (CST.isCollection(token)) {
|
||||
for (const t of token.items) {
|
||||
if (node.srcToken !== t.value)
|
||||
continue;
|
||||
const anchor = getAnchorFromCollectionItem(t);
|
||||
if (anchor) {
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function getAnchorFromCollectionItem(token) {
|
||||
for (const t of token.start) {
|
||||
if (t.type === 'anchor') {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
if (token.sep && Array.isArray(token.sep)) {
|
||||
for (const t of token.sep) {
|
||||
if (t.type === 'anchor') {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=unused-anchors.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"unused-anchors.js","sourceRoot":"","sources":["../../../../../src/languageservice/services/validation/unused-anchors.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,YAAY,EA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O,CAAC,CAAC;SACV;KACF;IACD,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACzC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE;YACzB,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACvB,OAAO,CAAC,CAAC;aACV;SACF;KACF;AACH,CAAC"}
|
||||
@@ -1,12 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Diagnostic } from 'vscode-languageserver-types';
|
||||
import { SingleYAMLDocument } from '../../parser/yaml-documents';
|
||||
import { LanguageSettings } from '../../yamlLanguageService';
|
||||
import { AdditionalValidator } from './types';
|
||||
export declare class YAMLStyleValidator implements AdditionalValidator {
|
||||
private forbidSequence;
|
||||
private forbidMapping;
|
||||
constructor(settings: LanguageSettings);
|
||||
validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[];
|
||||
private getRangeOf;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types';
|
||||
import { isMap, isSeq, visit } from 'yaml';
|
||||
export class YAMLStyleValidator {
|
||||
constructor(settings) {
|
||||
this.forbidMapping = settings.flowMapping === 'forbid';
|
||||
this.forbidSequence = settings.flowSequence === 'forbid';
|
||||
}
|
||||
validate(document, yamlDoc) {
|
||||
const result = [];
|
||||
visit(yamlDoc.internalDocument, (key, node) => {
|
||||
if (this.forbidMapping && isMap(node) && node.srcToken?.type === 'flow-collection') {
|
||||
result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), 'Flow style mapping is forbidden', DiagnosticSeverity.Error, 'flowMap'));
|
||||
}
|
||||
if (this.forbidSequence && isSeq(node) && node.srcToken?.type === 'flow-collection') {
|
||||
result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), 'Flow style sequence is forbidden', DiagnosticSeverity.Error, 'flowSeq'));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
getRangeOf(document, node) {
|
||||
return Range.create(document.positionAt(node.start.offset), document.positionAt(node.end.pop().offset));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yaml-style.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yaml-style.js","sourceRoot":"","sources":["../../../../../src/languageservice/services/validation/yaml-style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAM3C,MAAM,OAAO,kBAAkB;IAI7B,YAAY,QAA0B;QACpC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC;QACvD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,YAAY,KAAK,QAAQ,CAAC;IAC3D,CAAC;IACD,QAAQ,CAAC,QAAsB,EAAE,OAA2B;QAC1D,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAC5C,IAAI,IAAI,CAAC,aAAa,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,KAAK,iBAAiB,EAAE;gBAClF,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,MAAM,CACf,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxC,iCAAiC,EACjC,kBAAkB,CAAC,KAAK,EACxB,SAAS,CACV,CACF,CAAC;aACH;YACD,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,KAAK,iBAAiB,EAAE;gBACnF,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,MAAM,CACf,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EACxC,kCAAkC,EAClC,kBAAkB,CAAC,KAAK,EACxB,SAAS,CACV,CACF,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,UAAU,CAAC,QAAsB,EAAE,IAAoB;QAC7D,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1G,CAAC;CACF"}
|
||||
17
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.d.ts
generated
vendored
17
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.d.ts
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { CodeAction } from 'vscode-languageserver-types';
|
||||
import { ClientCapabilities, CodeActionParams } from 'vscode-languageserver-protocol';
|
||||
import { LanguageSettings } from '../yamlLanguageService';
|
||||
export declare class YamlCodeActions {
|
||||
private readonly clientCapabilities;
|
||||
private indentation;
|
||||
constructor(clientCapabilities: ClientCapabilities);
|
||||
configure(settings: LanguageSettings): void;
|
||||
getCodeAction(document: TextDocument, params: CodeActionParams): CodeAction[] | undefined;
|
||||
private getJumpToSchemaActions;
|
||||
private getTabToSpaceConverting;
|
||||
private getUnusedAnchorsDelete;
|
||||
private getConvertToBooleanActions;
|
||||
private getConvertToBlockStyleActions;
|
||||
private getKeyOrderActions;
|
||||
}
|
||||
253
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.js
generated
vendored
253
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.js
generated
vendored
@@ -1,253 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { CodeAction, CodeActionKind, Command, Position, Range, TextEdit, } from 'vscode-languageserver-types';
|
||||
import { YamlCommands } from '../../commands';
|
||||
import * as path from 'path';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
import { YAML_SOURCE } from '../parser/jsonParser07';
|
||||
import { getFirstNonWhitespaceCharacterAfterOffset } from '../utils/strings';
|
||||
import { matchOffsetToDocument } from '../utils/arrUtils';
|
||||
import { CST, isMap, isSeq } from 'yaml';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { FlowStyleRewriter } from '../utils/flow-style-rewriter';
|
||||
import * as _ from 'lodash';
|
||||
export class YamlCodeActions {
|
||||
constructor(clientCapabilities) {
|
||||
this.clientCapabilities = clientCapabilities;
|
||||
this.indentation = ' ';
|
||||
}
|
||||
configure(settings) {
|
||||
this.indentation = settings.indentation;
|
||||
}
|
||||
getCodeAction(document, params) {
|
||||
if (!params.context.diagnostics) {
|
||||
return;
|
||||
}
|
||||
const result = [];
|
||||
result.push(...this.getConvertToBooleanActions(params.context.diagnostics, document));
|
||||
result.push(...this.getJumpToSchemaActions(params.context.diagnostics));
|
||||
result.push(...this.getTabToSpaceConverting(params.context.diagnostics, document));
|
||||
result.push(...this.getUnusedAnchorsDelete(params.context.diagnostics, document));
|
||||
result.push(...this.getConvertToBlockStyleActions(params.context.diagnostics, document));
|
||||
result.push(...this.getKeyOrderActions(params.context.diagnostics, document));
|
||||
return result;
|
||||
}
|
||||
getJumpToSchemaActions(diagnostics) {
|
||||
const isOpenTextDocumentEnabled = this.clientCapabilities?.window?.showDocument?.support ?? false;
|
||||
if (!isOpenTextDocumentEnabled) {
|
||||
return [];
|
||||
}
|
||||
const schemaUriToDiagnostic = new Map();
|
||||
for (const diagnostic of diagnostics) {
|
||||
const schemaUri = diagnostic.data?.schemaUri || [];
|
||||
for (const schemaUriStr of schemaUri) {
|
||||
if (schemaUriStr) {
|
||||
if (!schemaUriToDiagnostic.has(schemaUriStr)) {
|
||||
schemaUriToDiagnostic.set(schemaUriStr, []);
|
||||
}
|
||||
schemaUriToDiagnostic.get(schemaUriStr).push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
const result = [];
|
||||
for (const schemaUri of schemaUriToDiagnostic.keys()) {
|
||||
const action = CodeAction.create(`Jump to schema location (${path.basename(schemaUri)})`, Command.create('JumpToSchema', YamlCommands.JUMP_TO_SCHEMA, schemaUri));
|
||||
action.diagnostics = schemaUriToDiagnostic.get(schemaUri);
|
||||
result.push(action);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getTabToSpaceConverting(diagnostics, document) {
|
||||
const result = [];
|
||||
const textBuff = new TextBuffer(document);
|
||||
const processedLine = [];
|
||||
for (const diag of diagnostics) {
|
||||
if (diag.message === 'Using tabs can lead to unpredictable results') {
|
||||
if (processedLine.includes(diag.range.start.line)) {
|
||||
continue;
|
||||
}
|
||||
const lineContent = textBuff.getLineContent(diag.range.start.line);
|
||||
let replacedTabs = 0;
|
||||
let newText = '';
|
||||
for (let i = diag.range.start.character; i <= diag.range.end.character; i++) {
|
||||
const char = lineContent.charAt(i);
|
||||
if (char !== '\t') {
|
||||
break;
|
||||
}
|
||||
replacedTabs++;
|
||||
newText += this.indentation;
|
||||
}
|
||||
processedLine.push(diag.range.start.line);
|
||||
let resultRange = diag.range;
|
||||
if (replacedTabs !== diag.range.end.character - diag.range.start.character) {
|
||||
resultRange = Range.create(diag.range.start, Position.create(diag.range.end.line, diag.range.start.character + replacedTabs));
|
||||
}
|
||||
result.push(CodeAction.create('Convert Tab to Spaces', createWorkspaceEdit(document.uri, [TextEdit.replace(resultRange, newText)]), CodeActionKind.QuickFix));
|
||||
}
|
||||
}
|
||||
if (result.length !== 0) {
|
||||
const replaceEdits = [];
|
||||
for (let i = 0; i <= textBuff.getLineCount(); i++) {
|
||||
const lineContent = textBuff.getLineContent(i);
|
||||
let replacedTabs = 0;
|
||||
let newText = '';
|
||||
for (let j = 0; j < lineContent.length; j++) {
|
||||
const char = lineContent.charAt(j);
|
||||
if (char !== ' ' && char !== '\t') {
|
||||
if (replacedTabs !== 0) {
|
||||
replaceEdits.push(TextEdit.replace(Range.create(i, j - replacedTabs, i, j), newText));
|
||||
replacedTabs = 0;
|
||||
newText = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (char === ' ' && replacedTabs !== 0) {
|
||||
replaceEdits.push(TextEdit.replace(Range.create(i, j - replacedTabs, i, j), newText));
|
||||
replacedTabs = 0;
|
||||
newText = '';
|
||||
continue;
|
||||
}
|
||||
if (char === '\t') {
|
||||
newText += this.indentation;
|
||||
replacedTabs++;
|
||||
}
|
||||
}
|
||||
// line contains only tabs
|
||||
if (replacedTabs !== 0) {
|
||||
replaceEdits.push(TextEdit.replace(Range.create(i, 0, i, textBuff.getLineLength(i)), newText));
|
||||
}
|
||||
}
|
||||
if (replaceEdits.length > 0) {
|
||||
result.push(CodeAction.create('Convert all Tabs to Spaces', createWorkspaceEdit(document.uri, replaceEdits), CodeActionKind.QuickFix));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getUnusedAnchorsDelete(diagnostics, document) {
|
||||
const result = [];
|
||||
const buffer = new TextBuffer(document);
|
||||
for (const diag of diagnostics) {
|
||||
if (diag.message.startsWith('Unused anchor') && diag.source === YAML_SOURCE) {
|
||||
const range = Range.create(diag.range.start, diag.range.end);
|
||||
const actual = buffer.getText(range);
|
||||
const lineContent = buffer.getLineContent(range.end.line);
|
||||
const lastWhitespaceChar = getFirstNonWhitespaceCharacterAfterOffset(lineContent, range.end.character);
|
||||
range.end.character = lastWhitespaceChar;
|
||||
const action = CodeAction.create(`Delete unused anchor: ${actual}`, createWorkspaceEdit(document.uri, [TextEdit.del(range)]), CodeActionKind.QuickFix);
|
||||
action.diagnostics = [diag];
|
||||
result.push(action);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getConvertToBooleanActions(diagnostics, document) {
|
||||
const results = [];
|
||||
for (const diagnostic of diagnostics) {
|
||||
if (diagnostic.message === 'Incorrect type. Expected "boolean".') {
|
||||
const value = document.getText(diagnostic.range).toLocaleLowerCase();
|
||||
if (value === '"true"' || value === '"false"' || value === "'true'" || value === "'false'") {
|
||||
const newValue = value.includes('true') ? 'true' : 'false';
|
||||
results.push(CodeAction.create('Convert to boolean', createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, newValue)]), CodeActionKind.QuickFix));
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
getConvertToBlockStyleActions(diagnostics, document) {
|
||||
const results = [];
|
||||
for (const diagnostic of diagnostics) {
|
||||
if (diagnostic.code === 'flowMap' || diagnostic.code === 'flowSeq') {
|
||||
const node = getNodeforDiagnostic(document, diagnostic);
|
||||
if (isMap(node.internalNode) || isSeq(node.internalNode)) {
|
||||
const blockTypeDescription = isMap(node.internalNode) ? 'map' : 'sequence';
|
||||
const rewriter = new FlowStyleRewriter(this.indentation);
|
||||
results.push(CodeAction.create(`Convert to block style ${blockTypeDescription}`, createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, rewriter.write(node))]), CodeActionKind.QuickFix));
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
getKeyOrderActions(diagnostics, document) {
|
||||
const results = [];
|
||||
for (const diagnostic of diagnostics) {
|
||||
if (diagnostic?.code === 'mapKeyOrder') {
|
||||
let node = getNodeforDiagnostic(document, diagnostic);
|
||||
while (node && node.type !== 'object') {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node && isMap(node.internalNode)) {
|
||||
const sorted = _.cloneDeep(node.internalNode);
|
||||
if ((sorted.srcToken.type === 'block-map' || sorted.srcToken.type === 'flow-collection') &&
|
||||
(node.internalNode.srcToken.type === 'block-map' || node.internalNode.srcToken.type === 'flow-collection')) {
|
||||
sorted.srcToken.items.sort((a, b) => {
|
||||
if (a.key && b.key && CST.isScalar(a.key) && CST.isScalar(b.key)) {
|
||||
return a.key.source.localeCompare(b.key.source);
|
||||
}
|
||||
if (!a.key && b.key) {
|
||||
return -1;
|
||||
}
|
||||
if (a.key && !b.key) {
|
||||
return 1;
|
||||
}
|
||||
if (!a.key && !b.key) {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
for (let i = 0; i < sorted.srcToken.items.length; i++) {
|
||||
const item = sorted.srcToken.items[i];
|
||||
const uItem = node.internalNode.srcToken.items[i];
|
||||
item.start = uItem.start;
|
||||
if (item.value?.type === 'alias' ||
|
||||
item.value?.type === 'scalar' ||
|
||||
item.value?.type === 'single-quoted-scalar' ||
|
||||
item.value?.type === 'double-quoted-scalar') {
|
||||
const newLineIndex = item.value?.end?.findIndex((p) => p.type === 'newline') ?? -1;
|
||||
let newLineToken = null;
|
||||
if (uItem.value?.type === 'block-scalar') {
|
||||
newLineToken = uItem.value?.props?.find((p) => p.type === 'newline');
|
||||
}
|
||||
else if (CST.isScalar(uItem.value)) {
|
||||
newLineToken = uItem.value?.end?.find((p) => p.type === 'newline');
|
||||
}
|
||||
if (newLineToken && newLineIndex < 0) {
|
||||
item.value.end = item.value.end ?? [];
|
||||
item.value.end.push(newLineToken);
|
||||
}
|
||||
if (!newLineToken && newLineIndex > -1) {
|
||||
item.value.end.splice(newLineIndex, 1);
|
||||
}
|
||||
}
|
||||
else if (item.value?.type === 'block-scalar') {
|
||||
const nwline = item.value.props.find((p) => p.type === 'newline');
|
||||
if (!nwline) {
|
||||
item.value.props.push({ type: 'newline', indent: 0, offset: item.value.offset, source: '\n' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const replaceRange = Range.create(document.positionAt(node.offset), document.positionAt(node.offset + node.length));
|
||||
results.push(CodeAction.create('Fix key order for this map', createWorkspaceEdit(document.uri, [TextEdit.replace(replaceRange, CST.stringify(sorted.srcToken))]), CodeActionKind.QuickFix));
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
function getNodeforDiagnostic(document, diagnostic) {
|
||||
const yamlDocuments = yamlDocumentsCache.getYamlDocument(document);
|
||||
const startOffset = document.offsetAt(diagnostic.range.start);
|
||||
const yamlDoc = matchOffsetToDocument(startOffset, yamlDocuments);
|
||||
const node = yamlDoc.getNodeFromOffset(startOffset);
|
||||
return node;
|
||||
}
|
||||
function createWorkspaceEdit(uri, edits) {
|
||||
const changes = {};
|
||||
changes[uri] = edits;
|
||||
const edit = {
|
||||
changes,
|
||||
};
|
||||
return edit;
|
||||
}
|
||||
//# sourceMappingURL=yamlCodeActions.js.map
|
||||
File diff suppressed because one or more lines are too long
11
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.d.ts
generated
vendored
11
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.d.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { CodeLens } from 'vscode-languageserver-types';
|
||||
import { YAMLSchemaService } from './yamlSchemaService';
|
||||
import { Telemetry } from '../telemetry';
|
||||
export declare class YamlCodeLens {
|
||||
private schemaService;
|
||||
private readonly telemetry?;
|
||||
constructor(schemaService: YAMLSchemaService, telemetry?: Telemetry);
|
||||
getCodeLens(document: TextDocument): Promise<CodeLens[]>;
|
||||
resolveCodeLens(param: CodeLens): PromiseLike<CodeLens> | CodeLens;
|
||||
}
|
||||
47
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.js
generated
vendored
47
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.js
generated
vendored
@@ -1,47 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { CodeLens, Range } from 'vscode-languageserver-types';
|
||||
import { YamlCommands } from '../../commands';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { getSchemaUrls } from '../utils/schemaUrls';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
import { getSchemaTitle } from '../utils/schemaUtils';
|
||||
export class YamlCodeLens {
|
||||
constructor(schemaService, telemetry) {
|
||||
this.schemaService = schemaService;
|
||||
this.telemetry = telemetry;
|
||||
}
|
||||
async getCodeLens(document) {
|
||||
const result = [];
|
||||
try {
|
||||
const yamlDocument = yamlDocumentsCache.getYamlDocument(document);
|
||||
let schemaUrls = new Map();
|
||||
for (const currentYAMLDoc of yamlDocument.documents) {
|
||||
const schema = await this.schemaService.getSchemaForResource(document.uri, currentYAMLDoc);
|
||||
if (schema?.schema) {
|
||||
// merge schemas from all docs to avoid duplicates
|
||||
schemaUrls = new Map([...getSchemaUrls(schema?.schema), ...schemaUrls]);
|
||||
}
|
||||
}
|
||||
for (const urlToSchema of schemaUrls) {
|
||||
const lens = CodeLens.create(Range.create(0, 0, 0, 0));
|
||||
lens.command = {
|
||||
title: getSchemaTitle(urlToSchema[1], urlToSchema[0]),
|
||||
command: YamlCommands.JUMP_TO_SCHEMA,
|
||||
arguments: [urlToSchema[0]],
|
||||
};
|
||||
result.push(lens);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.codeLens.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
resolveCodeLens(param) {
|
||||
return param;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlCodeLens.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlCodeLens.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlCodeLens.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,C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AY,CAAC,cAAc;oBACpC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;iBAC5B,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAC9F;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,eAAe,CAAC,KAAe;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
||||
3
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCommands.d.ts
generated
vendored
3
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCommands.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import { Connection } from 'vscode-languageserver';
|
||||
import { CommandExecutor } from '../../languageserver/commandExecutor';
|
||||
export declare function registerCommands(commandExecutor: CommandExecutor, connection: Connection): void;
|
||||
34
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCommands.js
generated
vendored
34
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCommands.js
generated
vendored
@@ -1,34 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { YamlCommands } from '../../commands';
|
||||
import { URI } from 'vscode-uri';
|
||||
export function registerCommands(commandExecutor, connection) {
|
||||
commandExecutor.registerCommand(YamlCommands.JUMP_TO_SCHEMA, async (uri) => {
|
||||
if (!uri) {
|
||||
return;
|
||||
}
|
||||
// if uri points to local file of its a windows path
|
||||
if (!uri.startsWith('file') && !/^[a-z]:[\\/]/i.test(uri)) {
|
||||
const origUri = URI.parse(uri);
|
||||
const customUri = URI.from({
|
||||
scheme: 'json-schema',
|
||||
authority: origUri.authority,
|
||||
path: origUri.path.endsWith('.json') ? origUri.path : origUri.path + '.json',
|
||||
fragment: uri,
|
||||
});
|
||||
uri = customUri.toString();
|
||||
}
|
||||
// test if uri is windows path, ie starts with 'c:\' and convert to URI
|
||||
if (/^[a-z]:[\\/]/i.test(uri)) {
|
||||
const winUri = URI.file(uri);
|
||||
uri = winUri.toString();
|
||||
}
|
||||
const result = await connection.window.showDocument({ uri: uri, external: false, takeFocus: true });
|
||||
if (!result) {
|
||||
connection.window.showErrorMessage(`Cannot open ${uri}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=yamlCommands.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlCommands.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlCommands.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,UAAU,gBAAgB,CAAC,eAAgC,EAAE,UAAsB;IACvF,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;QACjF,IAAI,CAAC,GAAG,EAAE;YACR,OAAO;SACR;QACD,oDAAoD;QACpD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACzD,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;gBACzB,MAAM,EAAE,aAAa;gBACrB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO;gBAC5E,QAAQ,EAAE,GAAG;aACd,CAAC,CAAC;YACH,GAAG,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;SAC5B;QAED,uEAAuE;QACvE,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC7B,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;SACzB;QAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpG,IAAI,CAAC,MAAM,EAAE;YACX,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;SAC1D;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
68
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.d.ts
generated
vendored
68
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.d.ts
generated
vendored
@@ -1,68 +0,0 @@
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { ClientCapabilities } from 'vscode-languageserver';
|
||||
import { CompletionItem as CompletionItemBase, CompletionList, Position } from 'vscode-languageserver-types';
|
||||
import { Telemetry } from '../telemetry';
|
||||
import { YamlDocuments } from '../parser/yaml-documents';
|
||||
import { LanguageSettings } from '../yamlLanguageService';
|
||||
import { YAMLSchemaService } from './yamlSchemaService';
|
||||
import { JSONSchema } from '../jsonSchema';
|
||||
interface ParentCompletionItemOptions {
|
||||
schema: JSONSchema;
|
||||
indent?: string;
|
||||
insertTexts?: string[];
|
||||
}
|
||||
interface CompletionItem extends CompletionItemBase {
|
||||
parent?: ParentCompletionItemOptions;
|
||||
}
|
||||
export declare class YamlCompletion {
|
||||
private schemaService;
|
||||
private clientCapabilities;
|
||||
private yamlDocument;
|
||||
private readonly telemetry?;
|
||||
private customTags;
|
||||
private completionEnabled;
|
||||
private configuredIndentation;
|
||||
private yamlVersion;
|
||||
private indentation;
|
||||
private arrayPrefixIndentation;
|
||||
private supportsMarkdown;
|
||||
private disableDefaultProperties;
|
||||
private parentSkeletonSelectedFirst;
|
||||
constructor(schemaService: YAMLSchemaService, clientCapabilities: ClientCapabilities, yamlDocument: YamlDocuments, telemetry?: Telemetry);
|
||||
configure(languageSettings: LanguageSettings): void;
|
||||
doComplete(document: TextDocument, position: Position, isKubernetes?: boolean, doComplete?: boolean): Promise<CompletionList>;
|
||||
updateCompletionText(completionItem: CompletionItem, text: string): void;
|
||||
mergeSimpleInsertTexts(label: string, existingText: string, addingText: string, oneOfSchema: boolean): string | undefined;
|
||||
getValuesFromInsertText(insertText: string): string[];
|
||||
private finalizeParentCompletion;
|
||||
private createTempObjNode;
|
||||
private addPropertyCompletions;
|
||||
private getValueCompletions;
|
||||
private addArrayItemValueCompletion;
|
||||
private getInsertTextForProperty;
|
||||
private getInsertTextForObject;
|
||||
private getInsertTextForArray;
|
||||
private getInsertTextForGuessedValue;
|
||||
private getInsertTextForPlainText;
|
||||
private getInsertTextForValue;
|
||||
private getInsertTemplateForValue;
|
||||
private addSchemaValueCompletions;
|
||||
private collectTypes;
|
||||
private addDefaultValueCompletions;
|
||||
private addEnumValueCompletions;
|
||||
private getLabelForValue;
|
||||
private collectDefaultSnippets;
|
||||
private getInsertTextForSnippetValue;
|
||||
private addBooleanValueCompletion;
|
||||
private addNullValueCompletion;
|
||||
private getLabelForSnippetValue;
|
||||
private getCustomTagValueCompletions;
|
||||
private addCustomTagValueCompletion;
|
||||
private getDocumentationWithMarkdownText;
|
||||
private getSuggestionKind;
|
||||
private getCurrentWord;
|
||||
private fromMarkup;
|
||||
private doesSupportMarkdown;
|
||||
private findItemAtOffset;
|
||||
}
|
||||
export {};
|
||||
1459
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.js
generated
vendored
1459
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.js
generated
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,9 +0,0 @@
|
||||
import { DefinitionParams } from 'vscode-languageserver-protocol';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { DefinitionLink } from 'vscode-languageserver-types';
|
||||
import { Telemetry } from '../telemetry';
|
||||
export declare class YamlDefinition {
|
||||
private readonly telemetry?;
|
||||
constructor(telemetry?: Telemetry);
|
||||
getDefinition(document: TextDocument, params: DefinitionParams): DefinitionLink[] | undefined;
|
||||
}
|
||||
38
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlDefinition.js
generated
vendored
38
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlDefinition.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { LocationLink, Range } from 'vscode-languageserver-types';
|
||||
import { isAlias } from 'yaml';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { matchOffsetToDocument } from '../utils/arrUtils';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
export class YamlDefinition {
|
||||
constructor(telemetry) {
|
||||
this.telemetry = telemetry;
|
||||
}
|
||||
getDefinition(document, params) {
|
||||
try {
|
||||
const yamlDocument = yamlDocumentsCache.getYamlDocument(document);
|
||||
const offset = document.offsetAt(params.position);
|
||||
const currentDoc = matchOffsetToDocument(offset, yamlDocument);
|
||||
if (currentDoc) {
|
||||
const [node] = currentDoc.getNodeFromPosition(offset, new TextBuffer(document));
|
||||
if (node && isAlias(node)) {
|
||||
const defNode = node.resolve(currentDoc.internalDocument);
|
||||
if (defNode && defNode.range) {
|
||||
const targetRange = Range.create(document.positionAt(defNode.range[0]), document.positionAt(defNode.range[2]));
|
||||
const selectionRange = Range.create(document.positionAt(defNode.range[0]), document.positionAt(defNode.range[1]));
|
||||
return [LocationLink.create(document.uri, targetRange, selectionRange)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.definition.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlDefinition.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlDefinition.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAAkB,YAAY,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,cAAc;IACzB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD,aAAa,CAAC,QAAsB,EAAE,MAAwB;QAC5D,IAAI;YACF,MAAM,YAAY,GAAG,kBAAkB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YAClE,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC/D,IAAI,UAAU,EAAE;gBACd,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAChF,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;oBACzB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;oBAC1D,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE;wBAC5B,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC/G,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClH,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;qBACzE;iBACF;aACF;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAChG;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
||||
4
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFolding.d.ts
generated
vendored
4
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFolding.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
import { FoldingRange } from 'vscode-languageserver-types';
|
||||
import { FoldingRangesContext } from '../yamlTypes';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export declare function getFoldingRanges(document: TextDocument, context: FoldingRangesContext): FoldingRange[] | undefined;
|
||||
62
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFolding.js
generated
vendored
62
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFolding.js
generated
vendored
@@ -1,62 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { FoldingRange, Range } from 'vscode-languageserver-types';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
export function getFoldingRanges(document, context) {
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
const result = [];
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
for (const ymlDoc of doc.documents) {
|
||||
if (doc.documents.length > 1) {
|
||||
result.push(createNormalizedFolding(document, ymlDoc.root));
|
||||
}
|
||||
ymlDoc.visit((node) => {
|
||||
if (node.type === 'object' && node.parent?.type === 'array') {
|
||||
result.push(createNormalizedFolding(document, node));
|
||||
}
|
||||
if (node.type === 'property' && node.valueNode) {
|
||||
switch (node.valueNode.type) {
|
||||
case 'array':
|
||||
case 'object':
|
||||
result.push(createNormalizedFolding(document, node));
|
||||
break;
|
||||
case 'string': {
|
||||
// check if it is a multi-line string
|
||||
const nodePosn = document.positionAt(node.offset);
|
||||
const valuePosn = document.positionAt(node.valueNode.offset + node.valueNode.length);
|
||||
if (nodePosn.line !== valuePosn.line) {
|
||||
result.push(createNormalizedFolding(document, node));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
const rangeLimit = context && context.rangeLimit;
|
||||
if (typeof rangeLimit !== 'number' || result.length <= rangeLimit) {
|
||||
return result;
|
||||
}
|
||||
if (context && context.onRangeLimitExceeded) {
|
||||
context.onRangeLimitExceeded(document.uri);
|
||||
}
|
||||
return result.slice(0, context.rangeLimit);
|
||||
}
|
||||
function createNormalizedFolding(document, node) {
|
||||
const startPos = document.positionAt(node.offset);
|
||||
let endPos = document.positionAt(node.offset + node.length);
|
||||
const textFragment = document.getText(Range.create(startPos, endPos));
|
||||
const newLength = textFragment.length - textFragment.trimRight().length;
|
||||
if (newLength > 0) {
|
||||
endPos = document.positionAt(node.offset + node.length - newLength);
|
||||
}
|
||||
return FoldingRange.create(startPos.line, endPos.line, startPos.character, endPos.character);
|
||||
}
|
||||
//# sourceMappingURL=yamlFolding.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlFolding.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlFolding.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,MAAM,UAAU,gBAAgB,CAAC,QAAsB,EAAE,OAA6B;IACpF,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO;KACR;IACD,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,kBAAkB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzD,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE;QAClC,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAC7D;QACD,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE;YACpB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,OAAO,EAAE;gBAC3D,MAAM,CAAC,IAAI,CAAC,u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AAuB,CAAC,QAAsB,EAAE,IAAa;IACpE,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IACxE,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;KACrE;IACD,OAAO,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;AAC/F,CAAC"}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { TextEdit, FormattingOptions } from 'vscode-languageserver-types';
|
||||
import { CustomFormatterOptions, LanguageSettings } from '../yamlLanguageService';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export declare class YAMLFormatter {
|
||||
private formatterEnabled;
|
||||
configure(shouldFormat: LanguageSettings): void;
|
||||
format(document: TextDocument, options?: Partial<FormattingOptions> & CustomFormatterOptions): TextEdit[];
|
||||
}
|
||||
44
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFormatter.js
generated
vendored
44
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlFormatter.js
generated
vendored
@@ -1,44 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Adam Voss. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Range, Position, TextEdit } from 'vscode-languageserver-types';
|
||||
import * as prettier from 'prettier';
|
||||
import * as parser from 'prettier/parser-yaml';
|
||||
export class YAMLFormatter {
|
||||
constructor() {
|
||||
this.formatterEnabled = true;
|
||||
}
|
||||
configure(shouldFormat) {
|
||||
if (shouldFormat) {
|
||||
this.formatterEnabled = shouldFormat.format;
|
||||
}
|
||||
}
|
||||
format(document, options = {}) {
|
||||
if (!this.formatterEnabled) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
const text = document.getText();
|
||||
const prettierOptions = {
|
||||
parser: 'yaml',
|
||||
plugins: [parser],
|
||||
// --- FormattingOptions ---
|
||||
tabWidth: options.tabWidth || options.tabSize,
|
||||
// --- CustomFormatterOptions ---
|
||||
singleQuote: options.singleQuote,
|
||||
bracketSpacing: options.bracketSpacing,
|
||||
// 'preserve' is the default for Options.proseWrap. See also server.ts
|
||||
proseWrap: 'always' === options.proseWrap ? 'always' : 'never' === options.proseWrap ? 'never' : 'preserve',
|
||||
printWidth: options.printWidth,
|
||||
};
|
||||
const formatted = prettier.format(text, prettierOptions);
|
||||
return [TextEdit.replace(Range.create(Position.create(0, 0), document.positionAt(text.length)), formatted)];
|
||||
}
|
||||
catch (error) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlFormatter.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlFormatter.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlFormatter.ts"],"names":[],"mappings":"AAAA;;;;gGAIgG;AAEhG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAG/C,MA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AAC;CACF"}
|
||||
16
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.d.ts
generated
vendored
16
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.d.ts
generated
vendored
@@ -1,16 +0,0 @@
|
||||
import { Hover, Position } from 'vscode-languageserver-types';
|
||||
import { LanguageSettings } from '../yamlLanguageService';
|
||||
import { YAMLSchemaService } from './yamlSchemaService';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Telemetry } from '../telemetry';
|
||||
export declare class YAMLHover {
|
||||
private readonly telemetry?;
|
||||
private shouldHover;
|
||||
private indentation;
|
||||
private schemaService;
|
||||
constructor(schemaService: YAMLSchemaService, telemetry?: Telemetry);
|
||||
configure(languageSettings: LanguageSettings): void;
|
||||
doHover(document: TextDocument, position: Position, isKubernetes?: boolean): Promise<Hover | null>;
|
||||
private getHover;
|
||||
private toMarkdown;
|
||||
}
|
||||
237
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js
generated
vendored
237
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js
generated
vendored
@@ -1,237 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { MarkupKind, Range } from 'vscode-languageserver-types';
|
||||
import { matchOffsetToDocument } from '../utils/arrUtils';
|
||||
import { setKubernetesParserOption } from '../parser/isKubernetes';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { URI } from 'vscode-uri';
|
||||
import * as path from 'path';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
import { stringify as stringifyYAML } from 'yaml';
|
||||
export class YAMLHover {
|
||||
constructor(schemaService, telemetry) {
|
||||
this.telemetry = telemetry;
|
||||
this.shouldHover = true;
|
||||
this.schemaService = schemaService;
|
||||
}
|
||||
configure(languageSettings) {
|
||||
if (languageSettings) {
|
||||
this.shouldHover = languageSettings.hover;
|
||||
this.indentation = languageSettings.indentation;
|
||||
}
|
||||
}
|
||||
doHover(document, position, isKubernetes = false) {
|
||||
try {
|
||||
if (!this.shouldHover || !document) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
const offset = document.offsetAt(position);
|
||||
const currentDoc = matchOffsetToDocument(offset, doc);
|
||||
if (currentDoc === null) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
setKubernetesParserOption(doc.documents, isKubernetes);
|
||||
const currentDocIndex = doc.documents.indexOf(currentDoc);
|
||||
currentDoc.currentDocIndex = currentDocIndex;
|
||||
return this.getHover(document, position, currentDoc);
|
||||
}
|
||||
catch (error) {
|
||||
this.telemetry?.sendError('yaml.hover.error', { error: convertErrorToTelemetryMsg(error) });
|
||||
}
|
||||
}
|
||||
// method copied from https://github.com/microsoft/vscode-json-languageservice/blob/2ea5ad3d2ffbbe40dea11cfe764a502becf113ce/src/services/jsonHover.ts#L23
|
||||
getHover(document, position, doc) {
|
||||
const offset = document.offsetAt(position);
|
||||
let node = doc.getNodeFromOffset(offset);
|
||||
if (!node ||
|
||||
((node.type === 'object' || node.type === 'array') && offset > node.offset + 1 && offset < node.offset + node.length - 1)) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
const hoverRangeNode = node;
|
||||
// use the property description when hovering over an object key
|
||||
if (node.type === 'string') {
|
||||
const parent = node.parent;
|
||||
if (parent && parent.type === 'property' && parent.keyNode === node) {
|
||||
node = parent.valueNode;
|
||||
if (!node) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
const hoverRange = Range.create(document.positionAt(hoverRangeNode.offset), document.positionAt(hoverRangeNode.offset + hoverRangeNode.length));
|
||||
const createHover = (contents) => {
|
||||
const markupContent = {
|
||||
kind: MarkupKind.Markdown,
|
||||
value: contents,
|
||||
};
|
||||
const result = {
|
||||
contents: markupContent,
|
||||
range: hoverRange,
|
||||
};
|
||||
return result;
|
||||
};
|
||||
const removePipe = (value) => {
|
||||
return value.replace(/\|\|\s*$/, '');
|
||||
};
|
||||
return this.schemaService.getSchemaForResource(document.uri, doc).then((schema) => {
|
||||
if (schema && node && !schema.errors.length) {
|
||||
const matchingSchemas = doc.getMatchingSchemas(schema.schema, node.offset);
|
||||
let title = undefined;
|
||||
let markdownDescription = undefined;
|
||||
let markdownEnumDescriptions = [];
|
||||
const markdownExamples = [];
|
||||
const markdownEnums = [];
|
||||
matchingSchemas.every((s) => {
|
||||
if ((s.node === node || (node.type === 'property' && node.valueNode === s.node)) && !s.inverted && s.schema) {
|
||||
title = title || s.schema.title || s.schema.closestTitle;
|
||||
markdownDescription = markdownDescription || s.schema.markdownDescription || this.toMarkdown(s.schema.description);
|
||||
if (s.schema.enum) {
|
||||
if (s.schema.markdownEnumDescriptions) {
|
||||
markdownEnumDescriptions = s.schema.markdownEnumDescriptions;
|
||||
}
|
||||
else if (s.schema.enumDescriptions) {
|
||||
markdownEnumDescriptions = s.schema.enumDescriptions.map(this.toMarkdown, this);
|
||||
}
|
||||
else {
|
||||
markdownEnumDescriptions = [];
|
||||
}
|
||||
s.schema.enum.forEach((enumValue, idx) => {
|
||||
if (typeof enumValue !== 'string') {
|
||||
enumValue = JSON.stringify(enumValue);
|
||||
}
|
||||
markdownEnums.push({
|
||||
value: enumValue,
|
||||
description: markdownEnumDescriptions[idx],
|
||||
});
|
||||
});
|
||||
}
|
||||
if (s.schema.anyOf && isAllSchemasMatched(node, matchingSchemas, s.schema)) {
|
||||
//if append title and description of all matched schemas on hover
|
||||
title = '';
|
||||
markdownDescription = '';
|
||||
s.schema.anyOf.forEach((childSchema, index) => {
|
||||
title += childSchema.title || s.schema.closestTitle || '';
|
||||
markdownDescription += childSchema.markdownDescription || this.toMarkdown(childSchema.description) || '';
|
||||
if (index !== s.schema.anyOf.length - 1) {
|
||||
title += ' || ';
|
||||
markdownDescription += ' || ';
|
||||
}
|
||||
});
|
||||
title = removePipe(title);
|
||||
markdownDescription = removePipe(markdownDescription);
|
||||
}
|
||||
if (s.schema.examples) {
|
||||
s.schema.examples.forEach((example) => {
|
||||
markdownExamples.push(stringifyYAML(example, null, 2));
|
||||
});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
let result = '';
|
||||
if (title) {
|
||||
result = '#### ' + this.toMarkdown(title);
|
||||
}
|
||||
if (markdownDescription) {
|
||||
result = ensureLineBreak(result);
|
||||
result += markdownDescription;
|
||||
}
|
||||
if (markdownEnums.length !== 0) {
|
||||
result = ensureLineBreak(result);
|
||||
result += 'Allowed Values:\n\n';
|
||||
markdownEnums.forEach((me) => {
|
||||
if (me.description) {
|
||||
result += `* \`${toMarkdownCodeBlock(me.value)}\`: ${me.description}\n`;
|
||||
}
|
||||
else {
|
||||
result += `* \`${toMarkdownCodeBlock(me.value)}\`\n`;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (markdownExamples.length !== 0) {
|
||||
markdownExamples.forEach((example) => {
|
||||
result = ensureLineBreak(result);
|
||||
result += 'Example:\n\n';
|
||||
result += `\`\`\`yaml\n${example}\`\`\`\n`;
|
||||
});
|
||||
}
|
||||
if (result.length > 0 && schema.schema.url) {
|
||||
result = ensureLineBreak(result);
|
||||
result += `Source: [${getSchemaName(schema.schema)}](${schema.schema.url})`;
|
||||
}
|
||||
return createHover(result);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
// copied from https://github.com/microsoft/vscode-json-languageservice/blob/2ea5ad3d2ffbbe40dea11cfe764a502becf113ce/src/services/jsonHover.ts#L112
|
||||
toMarkdown(plain) {
|
||||
if (plain) {
|
||||
let escaped = plain.replace(/([^\n\r])(\r?\n)([^\n\r])/gm, '$1\n\n$3'); // single new lines to \n\n (Markdown paragraph)
|
||||
escaped = escaped.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
|
||||
if (this.indentation !== undefined) {
|
||||
// escape indentation whitespace to prevent it from being converted to markdown code blocks.
|
||||
const indentationMatchRegex = new RegExp(` {${this.indentation.length}}`, 'g');
|
||||
escaped = escaped.replace(indentationMatchRegex, ' ');
|
||||
}
|
||||
return escaped;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function ensureLineBreak(content) {
|
||||
if (content.length === 0) {
|
||||
return content;
|
||||
}
|
||||
if (!content.endsWith('\n')) {
|
||||
content += '\n';
|
||||
}
|
||||
return content + '\n';
|
||||
}
|
||||
function getSchemaName(schema) {
|
||||
let result = 'JSON Schema';
|
||||
const urlString = schema.url;
|
||||
if (urlString) {
|
||||
const url = URI.parse(urlString);
|
||||
result = path.basename(url.fsPath);
|
||||
}
|
||||
else if (schema.title) {
|
||||
result = schema.title;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// copied from https://github.com/microsoft/vscode-json-languageservice/blob/2ea5ad3d2ffbbe40dea11cfe764a502becf113ce/src/services/jsonHover.ts#L122
|
||||
function toMarkdownCodeBlock(content) {
|
||||
// see https://daringfireball.net/projects/markdown/syntax#precode
|
||||
if (content.indexOf('`') !== -1) {
|
||||
return '`` ' + content + ' ``';
|
||||
}
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* check all the schemas which is inside anyOf presented or not in matching schema.
|
||||
* @param node node
|
||||
* @param matchingSchemas all matching schema
|
||||
* @param schema scheam which is having anyOf
|
||||
* @returns true if all the schemas which inside anyOf presents in matching schema
|
||||
*/
|
||||
function isAllSchemasMatched(node, matchingSchemas, schema) {
|
||||
let count = 0;
|
||||
for (const matchSchema of matchingSchemas) {
|
||||
if (node === matchSchema.node && matchSchema.schema !== schema) {
|
||||
schema.anyOf.forEach((childSchema) => {
|
||||
if (matchSchema.schema.title === childSchema.title &&
|
||||
matchSchema.schema.description === childSchema.description &&
|
||||
matchSchema.schema.properties === childSchema.properties) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return count === schema.anyOf.length;
|
||||
}
|
||||
//# sourceMappingURL=yamlHover.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.d.ts
generated
vendored
8
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.d.ts
generated
vendored
@@ -1,8 +0,0 @@
|
||||
import { DocumentLink } from 'vscode-languageserver-types';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Telemetry } from '../telemetry';
|
||||
export declare class YamlLinks {
|
||||
private readonly telemetry?;
|
||||
constructor(telemetry?: Telemetry);
|
||||
findLinks(document: TextDocument): Promise<DocumentLink[]>;
|
||||
}
|
||||
28
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js
generated
vendored
28
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { findLinks as JSONFindLinks } from 'vscode-json-languageservice/lib/umd/services/jsonLinks';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
export class YamlLinks {
|
||||
constructor(telemetry) {
|
||||
this.telemetry = telemetry;
|
||||
}
|
||||
findLinks(document) {
|
||||
try {
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
// Find links across all YAML Documents then report them back once finished
|
||||
const linkPromises = [];
|
||||
for (const yamlDoc of doc.documents) {
|
||||
linkPromises.push(JSONFindLinks(document, yamlDoc));
|
||||
}
|
||||
// Wait for all the promises to return and then flatten them into one DocumentLink array
|
||||
return Promise.all(linkPromises).then((yamlLinkArray) => [].concat(...yamlLinkArray));
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.documentLink.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlLinks.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlLinks.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlLinks.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlLinks.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAIpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,OAAO,SAAS;IACpB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD,SAAS,CAAC,QAAsB;QAC9B,IAAI;YACF,MAAM,GAAG,GAAG,kBAAkB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YACzD,2EAA2E;YAC3E,MAAM,YAAY,GAAG,EAAE,CAAC;YACxB,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,SAAS,EAAE;gBACnC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;aACrD;YACD,wFAAwF;YACxF,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;SACvF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAClG;IACH,CAAC;CACF"}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { DocumentOnTypeFormattingParams } from 'vscode-languageserver';
|
||||
import { TextEdit } from 'vscode-languageserver-types';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export declare function doDocumentOnTypeFormatting(document: TextDocument, params: DocumentOnTypeFormattingParams): TextEdit[] | undefined;
|
||||
@@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Position, Range, TextEdit } from 'vscode-languageserver-types';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
export function doDocumentOnTypeFormatting(document, params) {
|
||||
const { position } = params;
|
||||
const tb = new TextBuffer(document);
|
||||
if (params.ch === '\n') {
|
||||
const previousLine = tb.getLineContent(position.line - 1);
|
||||
if (previousLine.trimRight().endsWith(':')) {
|
||||
const currentLine = tb.getLineContent(position.line);
|
||||
const subLine = currentLine.substring(position.character, currentLine.length);
|
||||
const isInArray = previousLine.indexOf(' - ') !== -1;
|
||||
if (subLine.trimRight().length === 0) {
|
||||
const indentationFix = position.character - (previousLine.length - previousLine.trimLeft().length);
|
||||
if (indentationFix === params.options.tabSize && !isInArray) {
|
||||
return; // skip if line already has proper formatting
|
||||
}
|
||||
const result = [];
|
||||
if (currentLine.length > 0) {
|
||||
result.push(TextEdit.del(Range.create(position, Position.create(position.line, currentLine.length - 1))));
|
||||
}
|
||||
result.push(TextEdit.insert(position, ' '.repeat(params.options.tabSize + (isInArray ? 2 - indentationFix : 0))));
|
||||
return result;
|
||||
}
|
||||
if (isInArray) {
|
||||
return [TextEdit.insert(position, ' '.repeat(params.options.tabSize))];
|
||||
}
|
||||
}
|
||||
if (previousLine.trimRight().endsWith('|')) {
|
||||
return [TextEdit.insert(position, ' '.repeat(params.options.tabSize))];
|
||||
}
|
||||
if (previousLine.includes(' - ') && !previousLine.includes(': ')) {
|
||||
return [TextEdit.insert(position, '- ')];
|
||||
}
|
||||
if (previousLine.includes(' - ') && previousLine.includes(': ')) {
|
||||
return [TextEdit.insert(position, ' ')];
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlOnTypeFormatting.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlOnTypeFormatting.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlOnTypeFormatting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,UAAU,0BAA0B,CACxC,QAAsB,EACtB,MAAsC;IAEtC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,EAAE,KAAK,IAAI,EAAE;QACtB,MAAM,YAAY,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC1D,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC1C,MAAM,WAAW,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAC9E,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC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CAAC,CAAC,CAAC,CAAC;SACxE;QAED,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAChE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;SAC1C;QAED,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;SAC1C;KACF;AACH,CAAC"}
|
||||
102
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.d.ts
generated
vendored
102
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.d.ts
generated
vendored
@@ -1,102 +0,0 @@
|
||||
import { JSONSchema } from '../jsonSchema';
|
||||
import { SchemaPriority, SchemaRequestService, WorkspaceContextService } from '../yamlLanguageService';
|
||||
import { UnresolvedSchema, ResolvedSchema, JSONSchemaService, SchemaDependencies, ISchemaContributions, SchemaHandle } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService';
|
||||
import { JSONDocument } from '../parser/jsonParser07';
|
||||
import { JSONSchemaDescriptionExt } from '../../requestTypes';
|
||||
import { SchemaVersions } from '../yamlTypes';
|
||||
export declare type CustomSchemaProvider = (uri: string) => Promise<string | string[]>;
|
||||
export declare enum MODIFICATION_ACTIONS {
|
||||
'delete' = 0,
|
||||
'add' = 1,
|
||||
'deleteAll' = 2
|
||||
}
|
||||
export interface SchemaAdditions {
|
||||
schema: string;
|
||||
action: MODIFICATION_ACTIONS.add;
|
||||
path: string;
|
||||
key: string;
|
||||
content: any;
|
||||
}
|
||||
export interface SchemaDeletions {
|
||||
schema: string;
|
||||
action: MODIFICATION_ACTIONS.delete;
|
||||
path: string;
|
||||
key: string;
|
||||
}
|
||||
export interface SchemaDeletionsAll {
|
||||
schemas: string[];
|
||||
action: MODIFICATION_ACTIONS.deleteAll;
|
||||
}
|
||||
export declare class FilePatternAssociation {
|
||||
private schemas;
|
||||
private patternRegExp;
|
||||
constructor(pattern: string);
|
||||
addSchema(id: string): void;
|
||||
matchesPattern(fileName: string): boolean;
|
||||
getSchemas(): string[];
|
||||
}
|
||||
export declare class YAMLSchemaService extends JSONSchemaService {
|
||||
[x: string]: any;
|
||||
private customSchemaProvider;
|
||||
private filePatternAssociations;
|
||||
private contextService;
|
||||
private requestService;
|
||||
schemaPriorityMapping: Map<string, Set<SchemaPriority>>;
|
||||
private schemaUriToNameAndDescription;
|
||||
constructor(requestService: SchemaRequestService, contextService?: WorkspaceContextService, promiseConstructor?: PromiseConstructor);
|
||||
registerCustomSchemaProvider(customSchemaProvider: CustomSchemaProvider): void;
|
||||
getAllSchemas(): JSONSchemaDescriptionExt[];
|
||||
resolveSchemaContent(schemaToResolve: UnresolvedSchema, schemaURL: string, dependencies: SchemaDependencies): Promise<ResolvedSchema>;
|
||||
getSchemaForResource(resource: string, doc: JSONDocument): Promise<ResolvedSchema>;
|
||||
addSchemaPriority(uri: string, priority: number): void;
|
||||
/**
|
||||
* Search through all the schemas and find the ones with the highest priority
|
||||
*/
|
||||
private highestPrioritySchemas;
|
||||
private resolveCustomSchema;
|
||||
/**
|
||||
* Save a schema with schema ID and schema content.
|
||||
* Overrides previous schemas set for that schema ID.
|
||||
*/
|
||||
saveSchema(schemaId: string, schemaContent: JSONSchema): Promise<void>;
|
||||
/**
|
||||
* Delete schemas on specific path
|
||||
*/
|
||||
deleteSchemas(deletions: SchemaDeletionsAll): Promise<void>;
|
||||
/**
|
||||
* Delete a schema with schema ID.
|
||||
*/
|
||||
deleteSchema(schemaId: string): Promise<void>;
|
||||
/**
|
||||
* Add content to a specified schema at a specified path
|
||||
*/
|
||||
addContent(additions: SchemaAdditions): Promise<void>;
|
||||
/**
|
||||
* Delete content in a specified schema at a specified path
|
||||
*/
|
||||
deleteContent(deletions: SchemaDeletions): Promise<void>;
|
||||
/**
|
||||
* Take a JSON Schema and the path that you would like to get to
|
||||
* @returns the JSON Schema resolved at that specific path
|
||||
*/
|
||||
private resolveJSONSchemaToSection;
|
||||
/**
|
||||
* Resolve the next Object if they have compatible types
|
||||
* @param object a location in the JSON Schema
|
||||
* @param token the next token that you want to search for
|
||||
*/
|
||||
private resolveNext;
|
||||
/**
|
||||
* Everything below here is needed because we're importing from vscode-json-languageservice umd and we need
|
||||
* to provide a wrapper around the javascript methods we are calling since they have no type
|
||||
*/
|
||||
normalizeId(id: string): string;
|
||||
getOrAddSchemaHandle(id: string, unresolvedSchemaContent?: JSONSchema): SchemaHandle;
|
||||
loadSchema(schemaUri: string): Promise<UnresolvedSchema>;
|
||||
registerExternalSchema(uri: string, filePatterns?: string[], unresolvedSchema?: JSONSchema, name?: string, description?: string, versions?: SchemaVersions): SchemaHandle;
|
||||
clearExternalSchemas(): void;
|
||||
setSchemaContributions(schemaContributions: ISchemaContributions): void;
|
||||
getRegisteredSchemaIds(filter?: (scheme: any) => boolean): string[];
|
||||
getResolvedSchema(schemaId: string): Promise<ResolvedSchema>;
|
||||
onResourceChange(uri: string): boolean;
|
||||
}
|
||||
570
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js
generated
vendored
570
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js
generated
vendored
@@ -1,570 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { SchemaPriority } from '../yamlLanguageService';
|
||||
import { UnresolvedSchema, ResolvedSchema, JSONSchemaService, } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService';
|
||||
import { URI } from 'vscode-uri';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { convertSimple2RegExpPattern } from '../utils/strings';
|
||||
import { parse } from 'yaml';
|
||||
import * as path from 'path';
|
||||
import { getSchemaFromModeline } from './modelineUtil';
|
||||
import Ajv from 'ajv';
|
||||
import { getSchemaTitle } from '../utils/schemaUtils';
|
||||
const localize = nls.loadMessageBundle();
|
||||
const ajv = new Ajv();
|
||||
// load JSON Schema 07 def to validate loaded schemas
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const jsonSchema07 = require('ajv/dist/refs/json-schema-draft-07.json');
|
||||
const schema07Validator = ajv.compile(jsonSchema07);
|
||||
export var MODIFICATION_ACTIONS;
|
||||
(function (MODIFICATION_ACTIONS) {
|
||||
MODIFICATION_ACTIONS[MODIFICATION_ACTIONS["delete"] = 0] = "delete";
|
||||
MODIFICATION_ACTIONS[MODIFICATION_ACTIONS["add"] = 1] = "add";
|
||||
MODIFICATION_ACTIONS[MODIFICATION_ACTIONS["deleteAll"] = 2] = "deleteAll";
|
||||
})(MODIFICATION_ACTIONS || (MODIFICATION_ACTIONS = {}));
|
||||
export class FilePatternAssociation {
|
||||
constructor(pattern) {
|
||||
try {
|
||||
this.patternRegExp = new RegExp(convertSimple2RegExpPattern(pattern) + '$');
|
||||
}
|
||||
catch (e) {
|
||||
// invalid pattern
|
||||
this.patternRegExp = null;
|
||||
}
|
||||
this.schemas = [];
|
||||
}
|
||||
addSchema(id) {
|
||||
this.schemas.push(id);
|
||||
}
|
||||
matchesPattern(fileName) {
|
||||
return this.patternRegExp && this.patternRegExp.test(fileName);
|
||||
}
|
||||
getSchemas() {
|
||||
return this.schemas;
|
||||
}
|
||||
}
|
||||
export class YAMLSchemaService extends JSONSchemaService {
|
||||
constructor(requestService, contextService, promiseConstructor) {
|
||||
super(requestService, contextService, promiseConstructor);
|
||||
this.schemaUriToNameAndDescription = new Map();
|
||||
this.customSchemaProvider = undefined;
|
||||
this.requestService = requestService;
|
||||
this.schemaPriorityMapping = new Map();
|
||||
}
|
||||
registerCustomSchemaProvider(customSchemaProvider) {
|
||||
this.customSchemaProvider = customSchemaProvider;
|
||||
}
|
||||
getAllSchemas() {
|
||||
const result = [];
|
||||
const schemaUris = new Set();
|
||||
for (const filePattern of this.filePatternAssociations) {
|
||||
const schemaUri = filePattern.uris[0];
|
||||
if (schemaUris.has(schemaUri)) {
|
||||
continue;
|
||||
}
|
||||
schemaUris.add(schemaUri);
|
||||
const schemaHandle = {
|
||||
uri: schemaUri,
|
||||
fromStore: false,
|
||||
usedForCurrentFile: false,
|
||||
};
|
||||
if (this.schemaUriToNameAndDescription.has(schemaUri)) {
|
||||
const { name, description, versions } = this.schemaUriToNameAndDescription.get(schemaUri);
|
||||
schemaHandle.name = name;
|
||||
schemaHandle.description = description;
|
||||
schemaHandle.fromStore = true;
|
||||
schemaHandle.versions = versions;
|
||||
}
|
||||
result.push(schemaHandle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async resolveSchemaContent(schemaToResolve, schemaURL, dependencies) {
|
||||
const resolveErrors = schemaToResolve.errors.slice(0);
|
||||
let schema = schemaToResolve.schema;
|
||||
const contextService = this.contextService;
|
||||
if (!schema07Validator(schema)) {
|
||||
const errs = [];
|
||||
for (const err of schema07Validator.errors) {
|
||||
errs.push(`${err.instancePath} : ${err.message}`);
|
||||
}
|
||||
resolveErrors.push(`Schema '${getSchemaTitle(schemaToResolve.schema, schemaURL)}' is not valid:\n${errs.join('\n')}`);
|
||||
}
|
||||
const findSection = (schema, path) => {
|
||||
if (!path) {
|
||||
return schema;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let current = schema;
|
||||
if (path[0] === '/') {
|
||||
path = path.substr(1);
|
||||
}
|
||||
path.split('/').some((part) => {
|
||||
current = current[part];
|
||||
return !current;
|
||||
});
|
||||
return current;
|
||||
};
|
||||
const merge = (target, sourceRoot, sourceURI, path) => {
|
||||
const section = findSection(sourceRoot, path);
|
||||
if (section) {
|
||||
for (const key in section) {
|
||||
if (Object.prototype.hasOwnProperty.call(section, key) && !Object.prototype.hasOwnProperty.call(target, key)) {
|
||||
target[key] = section[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
resolveErrors.push(localize('json.schema.invalidref', "$ref '{0}' in '{1}' can not be resolved.", path, sourceURI));
|
||||
}
|
||||
};
|
||||
const resolveExternalLink = (node, uri, linkPath, parentSchemaURL, parentSchemaDependencies
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
) => {
|
||||
if (contextService && !/^\w+:\/\/.*/.test(uri)) {
|
||||
uri = contextService.resolveRelativePath(uri, parentSchemaURL);
|
||||
}
|
||||
uri = this.normalizeId(uri);
|
||||
const referencedHandle = this.getOrAddSchemaHandle(uri);
|
||||
return referencedHandle.getUnresolvedSchema().then((unresolvedSchema) => {
|
||||
parentSchemaDependencies[uri] = true;
|
||||
if (unresolvedSchema.errors.length) {
|
||||
const loc = linkPath ? uri + '#' + linkPath : uri;
|
||||
resolveErrors.push(localize('json.schema.problemloadingref', "Problems loading reference '{0}': {1}", loc, unresolvedSchema.errors[0]));
|
||||
}
|
||||
merge(node, unresolvedSchema.schema, uri, linkPath);
|
||||
node.url = uri;
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies);
|
||||
});
|
||||
};
|
||||
const resolveRefs = async (node, parentSchema, parentSchemaURL, parentSchemaDependencies
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
) => {
|
||||
if (!node || typeof node !== 'object') {
|
||||
return null;
|
||||
}
|
||||
const toWalk = [node];
|
||||
const seen = new Set();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const openPromises = [];
|
||||
const collectEntries = (...entries) => {
|
||||
for (const entry of entries) {
|
||||
if (typeof entry === 'object') {
|
||||
toWalk.push(entry);
|
||||
}
|
||||
}
|
||||
};
|
||||
const collectMapEntries = (...maps) => {
|
||||
for (const map of maps) {
|
||||
if (typeof map === 'object') {
|
||||
for (const key in map) {
|
||||
const entry = map[key];
|
||||
if (typeof entry === 'object') {
|
||||
toWalk.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const collectArrayEntries = (...arrays) => {
|
||||
for (const array of arrays) {
|
||||
if (Array.isArray(array)) {
|
||||
for (const entry of array) {
|
||||
if (typeof entry === 'object') {
|
||||
toWalk.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const handleRef = (next) => {
|
||||
const seenRefs = new Set();
|
||||
while (next.$ref) {
|
||||
const ref = next.$ref;
|
||||
const segments = ref.split('#', 2);
|
||||
//return back removed $ref. We lost info about referenced type without it.
|
||||
next._$ref = next.$ref;
|
||||
delete next.$ref;
|
||||
if (segments[0].length > 0) {
|
||||
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (!seenRefs.has(ref)) {
|
||||
merge(next, parentSchema, parentSchemaURL, segments[1]); // can set next.$ref again, use seenRefs to avoid circle
|
||||
seenRefs.add(ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
collectEntries(next.items, next.additionalItems, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else);
|
||||
collectMapEntries(next.definitions, next.properties, next.patternProperties, next.dependencies);
|
||||
collectArrayEntries(next.anyOf, next.allOf, next.oneOf, next.items, next.schemaSequence);
|
||||
};
|
||||
if (parentSchemaURL.indexOf('#') > 0) {
|
||||
const segments = parentSchemaURL.split('#', 2);
|
||||
if (segments[0].length > 0 && segments[1].length > 0) {
|
||||
const newSchema = {};
|
||||
await resolveExternalLink(newSchema, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies);
|
||||
for (const key in schema) {
|
||||
if (key === 'required') {
|
||||
continue;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(schema, key) && !Object.prototype.hasOwnProperty.call(newSchema, key)) {
|
||||
newSchema[key] = schema[key];
|
||||
}
|
||||
}
|
||||
schema = newSchema;
|
||||
}
|
||||
}
|
||||
while (toWalk.length) {
|
||||
const next = toWalk.pop();
|
||||
if (seen.has(next)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(next);
|
||||
handleRef(next);
|
||||
}
|
||||
return Promise.all(openPromises);
|
||||
};
|
||||
await resolveRefs(schema, schema, schemaURL, dependencies);
|
||||
return new ResolvedSchema(schema, resolveErrors);
|
||||
}
|
||||
getSchemaForResource(resource, doc) {
|
||||
const resolveModelineSchema = () => {
|
||||
let schemaFromModeline = getSchemaFromModeline(doc);
|
||||
if (schemaFromModeline !== undefined) {
|
||||
if (!schemaFromModeline.startsWith('file:') && !schemaFromModeline.startsWith('http')) {
|
||||
// If path contains a fragment and it is left intact, "#" will be
|
||||
// considered part of the filename and converted to "%23" by
|
||||
// path.resolve() -> take it out and add back after path.resolve
|
||||
let appendix = '';
|
||||
if (schemaFromModeline.indexOf('#') > 0) {
|
||||
const segments = schemaFromModeline.split('#', 2);
|
||||
schemaFromModeline = segments[0];
|
||||
appendix = segments[1];
|
||||
}
|
||||
if (!path.isAbsolute(schemaFromModeline)) {
|
||||
const resUri = URI.parse(resource);
|
||||
schemaFromModeline = URI.file(path.resolve(path.parse(resUri.fsPath).dir, schemaFromModeline)).toString();
|
||||
}
|
||||
else {
|
||||
schemaFromModeline = URI.file(schemaFromModeline).toString();
|
||||
}
|
||||
if (appendix.length > 0) {
|
||||
schemaFromModeline += '#' + appendix;
|
||||
}
|
||||
}
|
||||
return schemaFromModeline;
|
||||
}
|
||||
};
|
||||
const resolveSchemaForResource = (schemas) => {
|
||||
const schemaHandle = super.createCombinedSchema(resource, schemas);
|
||||
return schemaHandle.getResolvedSchema().then((schema) => {
|
||||
if (schema.schema && typeof schema.schema === 'object') {
|
||||
schema.schema.url = schemaHandle.url;
|
||||
}
|
||||
if (schema.schema &&
|
||||
schema.schema.schemaSequence &&
|
||||
schema.schema.schemaSequence[doc.currentDocIndex]) {
|
||||
return new ResolvedSchema(schema.schema.schemaSequence[doc.currentDocIndex]);
|
||||
}
|
||||
return schema;
|
||||
});
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const resolveSchema = () => {
|
||||
const seen = Object.create(null);
|
||||
const schemas = [];
|
||||
for (const entry of this.filePatternAssociations) {
|
||||
if (entry.matchesPattern(resource)) {
|
||||
for (const schemaId of entry.getURIs()) {
|
||||
if (!seen[schemaId]) {
|
||||
schemas.push(schemaId);
|
||||
seen[schemaId] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schemas.length > 0) {
|
||||
// Join all schemas with the highest priority.
|
||||
const highestPrioSchemas = this.highestPrioritySchemas(schemas);
|
||||
return resolveSchemaForResource(highestPrioSchemas);
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
};
|
||||
const modelineSchema = resolveModelineSchema();
|
||||
if (modelineSchema) {
|
||||
return resolveSchemaForResource([modelineSchema]);
|
||||
}
|
||||
if (this.customSchemaProvider) {
|
||||
return this.customSchemaProvider(resource)
|
||||
.then((schemaUri) => {
|
||||
if (Array.isArray(schemaUri)) {
|
||||
if (schemaUri.length === 0) {
|
||||
return resolveSchema();
|
||||
}
|
||||
return Promise.all(schemaUri.map((schemaUri) => {
|
||||
return this.resolveCustomSchema(schemaUri, doc);
|
||||
})).then((schemas) => {
|
||||
return {
|
||||
errors: [],
|
||||
schema: {
|
||||
allOf: schemas.map((schemaObj) => {
|
||||
return schemaObj.schema;
|
||||
}),
|
||||
},
|
||||
};
|
||||
}, () => {
|
||||
return resolveSchema();
|
||||
});
|
||||
}
|
||||
if (!schemaUri) {
|
||||
return resolveSchema();
|
||||
}
|
||||
return this.resolveCustomSchema(schemaUri, doc);
|
||||
})
|
||||
.then((schema) => {
|
||||
return schema;
|
||||
}, () => {
|
||||
return resolveSchema();
|
||||
});
|
||||
}
|
||||
else {
|
||||
return resolveSchema();
|
||||
}
|
||||
}
|
||||
// Set the priority of a schema in the schema service
|
||||
addSchemaPriority(uri, priority) {
|
||||
let currSchemaArray = this.schemaPriorityMapping.get(uri);
|
||||
if (currSchemaArray) {
|
||||
currSchemaArray = currSchemaArray.add(priority);
|
||||
this.schemaPriorityMapping.set(uri, currSchemaArray);
|
||||
}
|
||||
else {
|
||||
this.schemaPriorityMapping.set(uri, new Set().add(priority));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Search through all the schemas and find the ones with the highest priority
|
||||
*/
|
||||
highestPrioritySchemas(schemas) {
|
||||
let highestPrio = 0;
|
||||
const priorityMapping = new Map();
|
||||
schemas.forEach((schema) => {
|
||||
// If the schema does not have a priority then give it a default one of [0]
|
||||
const priority = this.schemaPriorityMapping.get(schema) || [0];
|
||||
priority.forEach((prio) => {
|
||||
if (prio > highestPrio) {
|
||||
highestPrio = prio;
|
||||
}
|
||||
// Build up a mapping of priority to schemas so that we can easily get the highest priority schemas easier
|
||||
let currPriorityArray = priorityMapping.get(prio);
|
||||
if (currPriorityArray) {
|
||||
currPriorityArray = currPriorityArray.concat(schema);
|
||||
priorityMapping.set(prio, currPriorityArray);
|
||||
}
|
||||
else {
|
||||
priorityMapping.set(prio, [schema]);
|
||||
}
|
||||
});
|
||||
});
|
||||
return priorityMapping.get(highestPrio) || [];
|
||||
}
|
||||
async resolveCustomSchema(schemaUri, doc) {
|
||||
const unresolvedSchema = await this.loadSchema(schemaUri);
|
||||
const schema = await this.resolveSchemaContent(unresolvedSchema, schemaUri, []);
|
||||
if (schema.schema && typeof schema.schema === 'object') {
|
||||
schema.schema.url = schemaUri;
|
||||
}
|
||||
if (schema.schema && schema.schema.schemaSequence && schema.schema.schemaSequence[doc.currentDocIndex]) {
|
||||
return new ResolvedSchema(schema.schema.schemaSequence[doc.currentDocIndex], schema.errors);
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
/**
|
||||
* Save a schema with schema ID and schema content.
|
||||
* Overrides previous schemas set for that schema ID.
|
||||
*/
|
||||
async saveSchema(schemaId, schemaContent) {
|
||||
const id = this.normalizeId(schemaId);
|
||||
this.getOrAddSchemaHandle(id, schemaContent);
|
||||
this.schemaPriorityMapping.set(id, new Set().add(SchemaPriority.Settings));
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
/**
|
||||
* Delete schemas on specific path
|
||||
*/
|
||||
async deleteSchemas(deletions) {
|
||||
deletions.schemas.forEach((s) => {
|
||||
this.deleteSchema(s);
|
||||
});
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
/**
|
||||
* Delete a schema with schema ID.
|
||||
*/
|
||||
async deleteSchema(schemaId) {
|
||||
const id = this.normalizeId(schemaId);
|
||||
if (this.schemasById[id]) {
|
||||
delete this.schemasById[id];
|
||||
}
|
||||
this.schemaPriorityMapping.delete(id);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
/**
|
||||
* Add content to a specified schema at a specified path
|
||||
*/
|
||||
async addContent(additions) {
|
||||
const schema = await this.getResolvedSchema(additions.schema);
|
||||
if (schema) {
|
||||
const resolvedSchemaLocation = this.resolveJSONSchemaToSection(schema.schema, additions.path);
|
||||
if (typeof resolvedSchemaLocation === 'object') {
|
||||
resolvedSchemaLocation[additions.key] = additions.content;
|
||||
}
|
||||
await this.saveSchema(additions.schema, schema.schema);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Delete content in a specified schema at a specified path
|
||||
*/
|
||||
async deleteContent(deletions) {
|
||||
const schema = await this.getResolvedSchema(deletions.schema);
|
||||
if (schema) {
|
||||
const resolvedSchemaLocation = this.resolveJSONSchemaToSection(schema.schema, deletions.path);
|
||||
if (typeof resolvedSchemaLocation === 'object') {
|
||||
delete resolvedSchemaLocation[deletions.key];
|
||||
}
|
||||
await this.saveSchema(deletions.schema, schema.schema);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Take a JSON Schema and the path that you would like to get to
|
||||
* @returns the JSON Schema resolved at that specific path
|
||||
*/
|
||||
resolveJSONSchemaToSection(schema, paths) {
|
||||
const splitPathway = paths.split('/');
|
||||
let resolvedSchemaLocation = schema;
|
||||
for (const path of splitPathway) {
|
||||
if (path === '') {
|
||||
continue;
|
||||
}
|
||||
this.resolveNext(resolvedSchemaLocation, path);
|
||||
resolvedSchemaLocation = resolvedSchemaLocation[path];
|
||||
}
|
||||
return resolvedSchemaLocation;
|
||||
}
|
||||
/**
|
||||
* Resolve the next Object if they have compatible types
|
||||
* @param object a location in the JSON Schema
|
||||
* @param token the next token that you want to search for
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
resolveNext(object, token) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if (Array.isArray(object) && isNaN(token)) {
|
||||
throw new Error('Expected a number after the array object');
|
||||
}
|
||||
else if (typeof object === 'object' && typeof token !== 'string') {
|
||||
throw new Error('Expected a string after the object');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Everything below here is needed because we're importing from vscode-json-languageservice umd and we need
|
||||
* to provide a wrapper around the javascript methods we are calling since they have no type
|
||||
*/
|
||||
normalizeId(id) {
|
||||
// The parent's `super.normalizeId(id)` isn't visible, so duplicated the code here
|
||||
try {
|
||||
return URI.parse(id).toString();
|
||||
}
|
||||
catch (e) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Everything below here is needed because we're importing from vscode-json-languageservice umd and we need
|
||||
* to provide a wrapper around the javascript methods we are calling since they have no type
|
||||
*/
|
||||
getOrAddSchemaHandle(id, unresolvedSchemaContent) {
|
||||
return super.getOrAddSchemaHandle(id, unresolvedSchemaContent);
|
||||
}
|
||||
loadSchema(schemaUri) {
|
||||
const requestService = this.requestService;
|
||||
return super.loadSchema(schemaUri).then((unresolvedJsonSchema) => {
|
||||
// If json-language-server failed to parse the schema, attempt to parse it as YAML instead.
|
||||
if (unresolvedJsonSchema.errors && unresolvedJsonSchema.schema === undefined) {
|
||||
return requestService(schemaUri).then((content) => {
|
||||
if (!content) {
|
||||
const errorMessage = localize('json.schema.nocontent', "Unable to load schema from '{0}': No content. {1}", toDisplayString(schemaUri), unresolvedJsonSchema.errors);
|
||||
return new UnresolvedSchema({}, [errorMessage]);
|
||||
}
|
||||
try {
|
||||
const schemaContent = parse(content);
|
||||
return new UnresolvedSchema(schemaContent, []);
|
||||
}
|
||||
catch (yamlError) {
|
||||
const errorMessage = localize('json.schema.invalidFormat', "Unable to parse content from '{0}': {1}.", toDisplayString(schemaUri), yamlError);
|
||||
return new UnresolvedSchema({}, [errorMessage]);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(error) => {
|
||||
let errorMessage = error.toString();
|
||||
const errorSplit = error.toString().split('Error: ');
|
||||
if (errorSplit.length > 1) {
|
||||
// more concise error message, URL and context are attached by caller anyways
|
||||
errorMessage = errorSplit[1];
|
||||
}
|
||||
return new UnresolvedSchema({}, [errorMessage]);
|
||||
});
|
||||
}
|
||||
unresolvedJsonSchema.uri = schemaUri;
|
||||
if (this.schemaUriToNameAndDescription.has(schemaUri)) {
|
||||
const { name, description, versions } = this.schemaUriToNameAndDescription.get(schemaUri);
|
||||
unresolvedJsonSchema.schema.title = name ?? unresolvedJsonSchema.schema.title;
|
||||
unresolvedJsonSchema.schema.description = description ?? unresolvedJsonSchema.schema.description;
|
||||
unresolvedJsonSchema.schema.versions = versions ?? unresolvedJsonSchema.schema.versions;
|
||||
}
|
||||
return unresolvedJsonSchema;
|
||||
});
|
||||
}
|
||||
registerExternalSchema(uri, filePatterns, unresolvedSchema, name, description, versions) {
|
||||
if (name || description) {
|
||||
this.schemaUriToNameAndDescription.set(uri, { name, description, versions });
|
||||
}
|
||||
return super.registerExternalSchema(uri, filePatterns, unresolvedSchema);
|
||||
}
|
||||
clearExternalSchemas() {
|
||||
super.clearExternalSchemas();
|
||||
}
|
||||
setSchemaContributions(schemaContributions) {
|
||||
super.setSchemaContributions(schemaContributions);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
getRegisteredSchemaIds(filter) {
|
||||
return super.getRegisteredSchemaIds(filter);
|
||||
}
|
||||
getResolvedSchema(schemaId) {
|
||||
return super.getResolvedSchema(schemaId);
|
||||
}
|
||||
onResourceChange(uri) {
|
||||
return super.onResourceChange(uri);
|
||||
}
|
||||
}
|
||||
function toDisplayString(url) {
|
||||
try {
|
||||
const uri = URI.parse(url);
|
||||
if (uri.scheme === 'file') {
|
||||
return uri.fsPath;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// ignore
|
||||
}
|
||||
return url;
|
||||
}
|
||||
//# sourceMappingURL=yamlSchemaService.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +0,0 @@
|
||||
import { Position, SelectionRange } from 'vscode-languageserver-types';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
export declare function getSelectionRanges(document: TextDocument, positions: Position[]): SelectionRange[];
|
||||
130
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSelectionRanges.js
generated
vendored
130
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSelectionRanges.js
generated
vendored
@@ -1,130 +0,0 @@
|
||||
import { SelectionRange } from 'vscode-languageserver-types';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
export function getSelectionRanges(document, positions) {
|
||||
const doc = yamlDocumentsCache.getYamlDocument(document);
|
||||
return positions.map((position) => {
|
||||
const ranges = getRanges(position);
|
||||
let current;
|
||||
for (const range of ranges) {
|
||||
current = SelectionRange.create(range, current);
|
||||
}
|
||||
return current ?? SelectionRange.create({ start: position, end: position });
|
||||
});
|
||||
function getRanges(position) {
|
||||
const offset = document.offsetAt(position);
|
||||
const result = [];
|
||||
for (const ymlDoc of doc.documents) {
|
||||
let currentNode;
|
||||
let overrideStartOffset;
|
||||
ymlDoc.visit((node) => {
|
||||
const endOffset = node.offset + node.length;
|
||||
// Skip if end offset doesn't even reach cursor position
|
||||
if (endOffset < offset) {
|
||||
return true;
|
||||
}
|
||||
// Skip if we're ending at new line
|
||||
// times:
|
||||
// - second: 1
|
||||
// millisecond: 10
|
||||
// | - second: 2
|
||||
// ↑ millisecond: 0
|
||||
// (| is actually part of { second: 1, millisecond: 10 })
|
||||
// \r\n doesn't matter here
|
||||
if (getTextFromOffsets(endOffset - 1, endOffset) === '\n') {
|
||||
if (endOffset - 1 < offset) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
let startOffset = node.offset;
|
||||
if (startOffset > offset) {
|
||||
// Recheck start offset for some special cases
|
||||
const newOffset = getStartOffsetForSpecialCases(node, position);
|
||||
if (!newOffset || newOffset > offset) {
|
||||
return true;
|
||||
}
|
||||
startOffset = newOffset;
|
||||
}
|
||||
// Allow equal for children to override
|
||||
if (!currentNode || startOffset >= currentNode.offset) {
|
||||
currentNode = node;
|
||||
overrideStartOffset = startOffset;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
while (currentNode) {
|
||||
const startOffset = overrideStartOffset ?? currentNode.offset;
|
||||
const endOffset = currentNode.offset + currentNode.length;
|
||||
const range = {
|
||||
start: document.positionAt(startOffset),
|
||||
end: document.positionAt(endOffset),
|
||||
};
|
||||
const text = document.getText(range);
|
||||
const trimmedText = trimEndNewLine(text);
|
||||
const trimmedEndOffset = startOffset + trimmedText.length;
|
||||
if (trimmedEndOffset >= offset) {
|
||||
range.end = document.positionAt(trimmedEndOffset);
|
||||
}
|
||||
// Add a jump between '' "" {} []
|
||||
const isSurroundedBy = (startCharacter, endCharacter) => {
|
||||
return trimmedText.startsWith(startCharacter) && trimmedText.endsWith(endCharacter || startCharacter);
|
||||
};
|
||||
if ((currentNode.type === 'string' && (isSurroundedBy("'") || isSurroundedBy('"'))) ||
|
||||
(currentNode.type === 'object' && isSurroundedBy('{', '}')) ||
|
||||
(currentNode.type === 'array' && isSurroundedBy('[', ']'))) {
|
||||
result.push({
|
||||
start: document.positionAt(startOffset + 1),
|
||||
end: document.positionAt(endOffset - 1),
|
||||
});
|
||||
}
|
||||
result.push(range);
|
||||
currentNode = currentNode.parent;
|
||||
overrideStartOffset = undefined;
|
||||
}
|
||||
// A position can't be in multiple documents
|
||||
if (result.length > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result.reverse();
|
||||
}
|
||||
function getStartOffsetForSpecialCases(node, position) {
|
||||
const nodeStartPosition = document.positionAt(node.offset);
|
||||
if (nodeStartPosition.line !== position.line) {
|
||||
return;
|
||||
}
|
||||
if (node.parent?.type === 'array') {
|
||||
// array:
|
||||
// - value
|
||||
// ↑
|
||||
if (getTextFromOffsets(node.offset - 2, node.offset) === '- ') {
|
||||
return node.offset - 2;
|
||||
}
|
||||
}
|
||||
if (node.type === 'array' || node.type === 'object') {
|
||||
// array:
|
||||
// - value
|
||||
// ↑
|
||||
const lineBeginning = { line: nodeStartPosition.line, character: 0 };
|
||||
const text = document.getText({ start: lineBeginning, end: nodeStartPosition });
|
||||
if (text.trim().length === 0) {
|
||||
return document.offsetAt(lineBeginning);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getTextFromOffsets(startOffset, endOffset) {
|
||||
return document.getText({
|
||||
start: document.positionAt(startOffset),
|
||||
end: document.positionAt(endOffset),
|
||||
});
|
||||
}
|
||||
}
|
||||
function trimEndNewLine(str) {
|
||||
if (str.endsWith('\r\n')) {
|
||||
return str.substring(0, str.length - 2);
|
||||
}
|
||||
if (str.endsWith('\n')) {
|
||||
return str.substring(0, str.length - 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
//# sourceMappingURL=yamlSelectionRanges.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlSelectionRanges.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlSelectionRanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D,MAAM,UAAU,kBAAkB,CAAC,QAAsB,EAAE,SAAqB;IAC9E,MAAM,GAAG,GAAG,kBAAkB,CAAC,eAAe,CAAC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AAE;gBAC7D,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;aACxB;SACF;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;YACnD,SAAS;YACT,YAAY;YACZ,IAAI;YACJ,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;YACrE,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAChF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5B,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED,SAAS,kBAAkB,CAAC,WAAmB,EAAE,SAAiB;QAChE,OAAO,QAAQ,CAAC,OAAO,CAAC;YACtB,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;YACvC,GAAG,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;SACpC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACxB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACzC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACtB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACzC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
||||
26
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.d.ts
generated
vendored
26
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.d.ts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import { Diagnostic } from 'vscode-languageserver-types';
|
||||
import { LanguageSettings } from '../yamlLanguageService';
|
||||
import { YAMLSchemaService } from './yamlSchemaService';
|
||||
import { YAMLDocDiagnostic } from '../utils/parseUtils';
|
||||
import { TextDocument } from 'vscode-languageserver-textdocument';
|
||||
import { Telemetry } from '../telemetry';
|
||||
/**
|
||||
* Convert a YAMLDocDiagnostic to a language server Diagnostic
|
||||
* @param yamlDiag A YAMLDocDiagnostic from the parser
|
||||
* @param textDocument TextDocument from the language server client
|
||||
*/
|
||||
export declare const yamlDiagToLSDiag: (yamlDiag: YAMLDocDiagnostic, textDocument: TextDocument) => Diagnostic;
|
||||
export declare class YAMLValidation {
|
||||
private readonly telemetry?;
|
||||
private validationEnabled;
|
||||
private customTags;
|
||||
private jsonValidation;
|
||||
private disableAdditionalProperties;
|
||||
private yamlVersion;
|
||||
private validators;
|
||||
private MATCHES_MULTIPLE;
|
||||
constructor(schemaService: YAMLSchemaService, telemetry?: Telemetry);
|
||||
configure(settings: LanguageSettings): void;
|
||||
doValidation(textDocument: TextDocument, isKubernetes?: boolean): Promise<Diagnostic[]>;
|
||||
private runAdditionalValidators;
|
||||
}
|
||||
129
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.js
generated
vendored
129
node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.js
generated
vendored
@@ -1,129 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Diagnostic, Position } from 'vscode-languageserver-types';
|
||||
import { JSONValidation } from 'vscode-json-languageservice/lib/umd/services/jsonValidation';
|
||||
import { YAML_SOURCE } from '../parser/jsonParser07';
|
||||
import { TextBuffer } from '../utils/textBuffer';
|
||||
import { yamlDocumentsCache } from '../parser/yaml-documents';
|
||||
import { convertErrorToTelemetryMsg } from '../utils/objects';
|
||||
import { UnusedAnchorsValidator } from './validation/unused-anchors';
|
||||
import { YAMLStyleValidator } from './validation/yaml-style';
|
||||
import { MapKeyOrderValidator } from './validation/map-key-order';
|
||||
/**
|
||||
* Convert a YAMLDocDiagnostic to a language server Diagnostic
|
||||
* @param yamlDiag A YAMLDocDiagnostic from the parser
|
||||
* @param textDocument TextDocument from the language server client
|
||||
*/
|
||||
export const yamlDiagToLSDiag = (yamlDiag, textDocument) => {
|
||||
const start = textDocument.positionAt(yamlDiag.location.start);
|
||||
const range = {
|
||||
start,
|
||||
end: yamlDiag.location.toLineEnd
|
||||
? Position.create(start.line, new TextBuffer(textDocument).getLineLength(start.line))
|
||||
: textDocument.positionAt(yamlDiag.location.end),
|
||||
};
|
||||
return Diagnostic.create(range, yamlDiag.message, yamlDiag.severity, yamlDiag.code, YAML_SOURCE);
|
||||
};
|
||||
export class YAMLValidation {
|
||||
constructor(schemaService, telemetry) {
|
||||
this.telemetry = telemetry;
|
||||
this.validators = [];
|
||||
this.MATCHES_MULTIPLE = 'Matches multiple schemas when only one must validate.';
|
||||
this.validationEnabled = true;
|
||||
this.jsonValidation = new JSONValidation(schemaService, Promise);
|
||||
}
|
||||
configure(settings) {
|
||||
this.validators = [];
|
||||
if (settings) {
|
||||
this.validationEnabled = settings.validate;
|
||||
this.customTags = settings.customTags;
|
||||
this.disableAdditionalProperties = settings.disableAdditionalProperties;
|
||||
this.yamlVersion = settings.yamlVersion;
|
||||
// Add style validator if flow style is set to forbid only.
|
||||
if (settings.flowMapping === 'forbid' || settings.flowSequence === 'forbid') {
|
||||
this.validators.push(new YAMLStyleValidator(settings));
|
||||
}
|
||||
if (settings.keyOrdering) {
|
||||
this.validators.push(new MapKeyOrderValidator());
|
||||
}
|
||||
}
|
||||
this.validators.push(new UnusedAnchorsValidator());
|
||||
}
|
||||
async doValidation(textDocument, isKubernetes = false) {
|
||||
if (!this.validationEnabled) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
const validationResult = [];
|
||||
try {
|
||||
const yamlDocument = yamlDocumentsCache.getYamlDocument(textDocument, { customTags: this.customTags, yamlVersion: this.yamlVersion }, true);
|
||||
let index = 0;
|
||||
for (const currentYAMLDoc of yamlDocument.documents) {
|
||||
currentYAMLDoc.isKubernetes = isKubernetes;
|
||||
currentYAMLDoc.currentDocIndex = index;
|
||||
currentYAMLDoc.disableAdditionalProperties = this.disableAdditionalProperties;
|
||||
currentYAMLDoc.uri = textDocument.uri;
|
||||
const validation = await this.jsonValidation.doValidation(textDocument, currentYAMLDoc);
|
||||
const syd = currentYAMLDoc;
|
||||
if (syd.errors.length > 0) {
|
||||
// TODO: Get rid of these type assertions (shouldn't need them)
|
||||
validationResult.push(...syd.errors);
|
||||
}
|
||||
if (syd.warnings.length > 0) {
|
||||
validationResult.push(...syd.warnings);
|
||||
}
|
||||
validationResult.push(...validation);
|
||||
validationResult.push(...this.runAdditionalValidators(textDocument, currentYAMLDoc));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.telemetry?.sendError('yaml.validation.error', { error: convertErrorToTelemetryMsg(err) });
|
||||
}
|
||||
let previousErr;
|
||||
const foundSignatures = new Set();
|
||||
const duplicateMessagesRemoved = [];
|
||||
for (let err of validationResult) {
|
||||
/**
|
||||
* A patch ontop of the validation that removes the
|
||||
* 'Matches many schemas' error for kubernetes
|
||||
* for a better user experience.
|
||||
*/
|
||||
if (isKubernetes && err.message === this.MATCHES_MULTIPLE) {
|
||||
continue;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(err, 'location')) {
|
||||
err = yamlDiagToLSDiag(err, textDocument);
|
||||
}
|
||||
if (!err.source) {
|
||||
err.source = YAML_SOURCE;
|
||||
}
|
||||
if (previousErr &&
|
||||
previousErr.message === err.message &&
|
||||
previousErr.range.end.line === err.range.start.line &&
|
||||
Math.abs(previousErr.range.end.character - err.range.end.character) >= 1) {
|
||||
previousErr.range.end = err.range.end;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
previousErr = err;
|
||||
}
|
||||
const errSig = err.range.start.line + ' ' + err.range.start.character + ' ' + err.message;
|
||||
if (!foundSignatures.has(errSig)) {
|
||||
duplicateMessagesRemoved.push(err);
|
||||
foundSignatures.add(errSig);
|
||||
}
|
||||
}
|
||||
return duplicateMessagesRemoved;
|
||||
}
|
||||
runAdditionalValidators(document, yarnDoc) {
|
||||
const result = [];
|
||||
for (const validator of this.validators) {
|
||||
result.push(...validator.validate(document, yarnDoc));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=yamlValidation.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"yamlValidation.js","sourceRoot":"","sources":["../../../../src/languageservice/services/yamlValidation.ts"],"names":[],"mappings":"AAAA;;;;gGAIgG;AAEhG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAMnE,OAAO,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAA2B,EAAE,YAA0B,EAAc,EAAE;IACtG,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,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WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EACxE;gBACA,WAAW,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;gBACtC,SAAS;aACV;iBAAM;gBACL,WAAW,GAAG,GAAG,CAAC;aACnB;YAED,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;YAC1F,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBAChC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;aAC7B;SACF;QAED,OAAO,wBAAwB,CAAC;IAClC,CAAC;IACO,uBAAuB,CAAC,QAAsB,EAAE,OAA2B;QACjF,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;YACvC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;SACvD;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
||||
16
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.d.ts
generated
vendored
16
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.d.ts
generated
vendored
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Due to LSP limitation this object must be JSON serializable
|
||||
*/
|
||||
export interface TelemetryEvent {
|
||||
name: string;
|
||||
type?: string;
|
||||
properties?: unknown;
|
||||
measures?: unknown;
|
||||
traits?: unknown;
|
||||
context?: unknown;
|
||||
}
|
||||
export interface Telemetry {
|
||||
send(event: TelemetryEvent): void;
|
||||
sendError(name: string, properties: unknown): void;
|
||||
sendTrack(name: string, properties: unknown): void;
|
||||
}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.js
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export {};
|
||||
//# sourceMappingURL=telemetry.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/telemetry.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../../src/languageservice/telemetry.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.d.ts
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import { YAMLDocument, SingleYAMLDocument } from '../parser/yamlParser07';
|
||||
export declare function getLineOffsets(textDocString: string): number[];
|
||||
export declare function removeDuplicatesObj<T>(objArray: T[]): T[];
|
||||
export declare function matchOffsetToDocument(offset: number, jsonDocuments: YAMLDocument): SingleYAMLDocument | null;
|
||||
export declare function filterInvalidCustomTags(customTags: string[]): string[];
|
||||
export declare function isArrayEqual(fst: Array<unknown>, snd: Array<unknown>): boolean;
|
||||
81
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js
generated
vendored
81
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js
generated
vendored
@@ -1,81 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export function getLineOffsets(textDocString) {
|
||||
const lineOffsets = [];
|
||||
const text = textDocString;
|
||||
let isLineStart = true;
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
if (isLineStart) {
|
||||
lineOffsets.push(i);
|
||||
isLineStart = false;
|
||||
}
|
||||
const ch = text.charAt(i);
|
||||
isLineStart = ch === '\r' || ch === '\n';
|
||||
if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (isLineStart && text.length > 0) {
|
||||
lineOffsets.push(text.length);
|
||||
}
|
||||
return lineOffsets;
|
||||
}
|
||||
export function removeDuplicatesObj(objArray) {
|
||||
const nonDuplicateSet = new Set();
|
||||
const nonDuplicateArr = [];
|
||||
for (const obj in objArray) {
|
||||
const currObj = objArray[obj];
|
||||
const stringifiedObj = JSON.stringify(currObj);
|
||||
if (!nonDuplicateSet.has(stringifiedObj)) {
|
||||
nonDuplicateArr.push(currObj);
|
||||
nonDuplicateSet.add(stringifiedObj);
|
||||
}
|
||||
}
|
||||
return nonDuplicateArr;
|
||||
}
|
||||
export function matchOffsetToDocument(offset, jsonDocuments) {
|
||||
for (const jsonDoc of jsonDocuments.documents) {
|
||||
if (jsonDoc.internalDocument && jsonDoc.internalDocument.range[0] <= offset && jsonDoc.internalDocument.range[2] >= offset) {
|
||||
return jsonDoc;
|
||||
}
|
||||
}
|
||||
if (jsonDocuments.documents.length === 1) {
|
||||
return jsonDocuments.documents[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
export function filterInvalidCustomTags(customTags) {
|
||||
const validCustomTags = ['mapping', 'scalar', 'sequence'];
|
||||
if (!customTags) {
|
||||
return [];
|
||||
}
|
||||
return customTags.filter((tag) => {
|
||||
if (typeof tag === 'string') {
|
||||
const typeInfo = tag.split(' ');
|
||||
const type = (typeInfo[1] && typeInfo[1].toLowerCase()) || 'scalar';
|
||||
// We need to check if map is a type because map will throw an error within the yaml-ast-parser
|
||||
if (type === 'map') {
|
||||
return false;
|
||||
}
|
||||
return validCustomTags.indexOf(type) !== -1;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
export function isArrayEqual(fst, snd) {
|
||||
if (!snd || !fst) {
|
||||
return false;
|
||||
}
|
||||
if (snd.length !== fst.length) {
|
||||
return false;
|
||||
}
|
||||
for (let index = fst.length - 1; index >= 0; index--) {
|
||||
if (fst[index] !== snd[index]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//# sourceMappingURL=arrUtils.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"arrUtils.js","sourceRoot":"","sources":["../../../../src/languageservice/utils/arrUtils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,UAAU,cAAc,CAAC,aAAqB;IAClD,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,aAAa,CAAC;IAC3B,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,WAAW,GAAG,KAAK,CAAC;SACrB;QACD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,WAAW,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;QACzC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,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oB;IAC1D,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAE1D,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAC;KACX;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC;YAEpE,+FAA+F;YAC/F,IAAI,IAAI,KAAK,KAAK,EAAE;gBAClB,OAAO,KAAK,CAAC;aACd;YAED,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,GAAmB,EAAE,GAAmB;IACnE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,KAAK,IAAI,KAAK,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;QACpD,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
||||
13
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.d.ts
generated
vendored
13
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.d.ts
generated
vendored
@@ -1,13 +0,0 @@
|
||||
import { Document, YAMLMap, YAMLSeq } from 'yaml';
|
||||
import { CollectionItem, Token } from 'yaml/dist/parse/cst';
|
||||
import { YamlNode } from '../jsonASTTypes';
|
||||
export declare function getParent(doc: Document, nodeToFind: YamlNode): YamlNode | undefined;
|
||||
export declare function isMapContainsEmptyPair(map: YAMLMap): boolean;
|
||||
export declare function indexOf(seq: YAMLSeq, item: YamlNode): number | undefined;
|
||||
/**
|
||||
* Check that given offset is in YAML comment
|
||||
* @param doc the yaml document
|
||||
* @param offset the offset to check
|
||||
*/
|
||||
export declare function isInComment(tokens: Token[], offset: number): boolean;
|
||||
export declare function isCollectionItem(token: unknown): token is CollectionItem;
|
||||
108
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.js
generated
vendored
108
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.js
generated
vendored
@@ -1,108 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { isDocument, isScalar, visit } from 'yaml';
|
||||
export function getParent(doc, nodeToFind) {
|
||||
let parentNode;
|
||||
visit(doc, (_, node, path) => {
|
||||
if (node === nodeToFind) {
|
||||
parentNode = path[path.length - 1];
|
||||
return visit.BREAK;
|
||||
}
|
||||
});
|
||||
if (isDocument(parentNode)) {
|
||||
return undefined;
|
||||
}
|
||||
return parentNode;
|
||||
}
|
||||
export function isMapContainsEmptyPair(map) {
|
||||
if (map.items.length > 1) {
|
||||
return false;
|
||||
}
|
||||
const pair = map.items[0];
|
||||
return isScalar(pair.key) && isScalar(pair.value) && pair.key.value === '' && !pair.value.value;
|
||||
}
|
||||
export function indexOf(seq, item) {
|
||||
for (const [i, obj] of seq.items.entries()) {
|
||||
if (item === obj) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Check that given offset is in YAML comment
|
||||
* @param doc the yaml document
|
||||
* @param offset the offset to check
|
||||
*/
|
||||
export function isInComment(tokens, offset) {
|
||||
let inComment = false;
|
||||
for (const token of tokens) {
|
||||
if (token.type === 'document') {
|
||||
_visit([], token, (item) => {
|
||||
if (isCollectionItem(item) && item.value?.type === 'comment') {
|
||||
if (token.offset <= offset && item.value.source.length + item.value.offset >= offset) {
|
||||
inComment = true;
|
||||
return visit.BREAK;
|
||||
}
|
||||
}
|
||||
else if (item.type === 'comment' && item.offset <= offset && item.offset + item.source.length >= offset) {
|
||||
inComment = true;
|
||||
return visit.BREAK;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (token.type === 'comment') {
|
||||
if (token.offset <= offset && token.source.length + token.offset >= offset) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (inComment) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return inComment;
|
||||
}
|
||||
export function isCollectionItem(token) {
|
||||
return token['start'] !== undefined;
|
||||
}
|
||||
function _visit(path, item, visitor) {
|
||||
let ctrl = visitor(item, path);
|
||||
if (typeof ctrl === 'symbol')
|
||||
return ctrl;
|
||||
for (const field of ['key', 'value']) {
|
||||
const token = item[field];
|
||||
if (token && 'items' in token) {
|
||||
for (let i = 0; i < token.items.length; ++i) {
|
||||
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
||||
if (typeof ci === 'number')
|
||||
i = ci - 1;
|
||||
else if (ci === visit.BREAK)
|
||||
return visit.BREAK;
|
||||
else if (ci === visit.REMOVE) {
|
||||
token.items.splice(i, 1);
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
if (typeof ctrl === 'function' && field === 'key')
|
||||
ctrl = ctrl(item, path);
|
||||
}
|
||||
}
|
||||
const token = item['sep'];
|
||||
if (token) {
|
||||
for (let i = 0; i < token.length; ++i) {
|
||||
const ci = _visit(Object.freeze(path), token[i], visitor);
|
||||
if (typeof ci === 'number')
|
||||
i = ci - 1;
|
||||
else if (ci === visit.BREAK)
|
||||
return visit.BREAK;
|
||||
else if (ci === visit.REMOVE) {
|
||||
token.items.splice(i, 1);
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;
|
||||
}
|
||||
//# sourceMappingURL=astUtils.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"astUtils.js","sourceRoot":"","sources":["../../../../src/languageservice/utils/astUtils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAY,UAAU,EAAE,QAAQ,EAAQ,KAAK,EAAoB,MAAM,MAAM,CAAC;AAOrF,MAAM,UAAU,SAAS,CAAC,GAAa,EAAE,UAAoB;IAC3D,IAAI,UAAgB,CAAC;IACrB,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAU,EAAE,IAAI,EAAE,EAAE;QACjC,IAAI,IAAI,KAAK,UAAU,EAAE;YACvB,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAS,CAAC;YAC3C,OAAO,KAAK,CAAC,KAAK,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;QAC1B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AACD,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CA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KAAK,CAAC,MAAM,EAAE;oBAC5B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBACzB,CAAC,IAAI,CAAC,CAAC;iBACR;aACF;YACD,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,KAAK,KAAK,KAAK;gBAAE,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC5E;KACF;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,KAAK,EAAE;QACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACrC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAC1D,IAAI,OAAO,EAAE,KAAK,QAAQ;gBAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;iBAClC,IAAI,EAAE,KAAK,KAAK,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC,KAAK,CAAC;iBAC3C,IAAI,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE;gBAC5B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACzB,CAAC,IAAI,CAAC,CAAC;aACR;SACF;KACF;IACD,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC"}
|
||||
415
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.d.ts
generated
vendored
415
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.d.ts
generated
vendored
@@ -1,415 +0,0 @@
|
||||
/**
|
||||
* An inlined enum containing useful character codes (to be used with String.charCodeAt).
|
||||
* Please leave the const keyword such that it gets inlined when compiled to JavaScript!
|
||||
*/
|
||||
export declare const enum CharCode {
|
||||
Null = 0,
|
||||
/**
|
||||
* The `\b` character.
|
||||
*/
|
||||
Backspace = 8,
|
||||
/**
|
||||
* The `\t` character.
|
||||
*/
|
||||
Tab = 9,
|
||||
/**
|
||||
* The `\n` character.
|
||||
*/
|
||||
LineFeed = 10,
|
||||
/**
|
||||
* The `\r` character.
|
||||
*/
|
||||
CarriageReturn = 13,
|
||||
Space = 32,
|
||||
/**
|
||||
* The `!` character.
|
||||
*/
|
||||
ExclamationMark = 33,
|
||||
/**
|
||||
* The `"` character.
|
||||
*/
|
||||
DoubleQuote = 34,
|
||||
/**
|
||||
* The `#` character.
|
||||
*/
|
||||
Hash = 35,
|
||||
/**
|
||||
* The `$` character.
|
||||
*/
|
||||
DollarSign = 36,
|
||||
/**
|
||||
* The `%` character.
|
||||
*/
|
||||
PercentSign = 37,
|
||||
/**
|
||||
* The `&` character.
|
||||
*/
|
||||
Ampersand = 38,
|
||||
/**
|
||||
* The `'` character.
|
||||
*/
|
||||
SingleQuote = 39,
|
||||
/**
|
||||
* The `(` character.
|
||||
*/
|
||||
OpenParen = 40,
|
||||
/**
|
||||
* The `)` character.
|
||||
*/
|
||||
CloseParen = 41,
|
||||
/**
|
||||
* The `*` character.
|
||||
*/
|
||||
Asterisk = 42,
|
||||
/**
|
||||
* The `+` character.
|
||||
*/
|
||||
Plus = 43,
|
||||
/**
|
||||
* The `,` character.
|
||||
*/
|
||||
Comma = 44,
|
||||
/**
|
||||
* The `-` character.
|
||||
*/
|
||||
Dash = 45,
|
||||
/**
|
||||
* The `.` character.
|
||||
*/
|
||||
Period = 46,
|
||||
/**
|
||||
* The `/` character.
|
||||
*/
|
||||
Slash = 47,
|
||||
Digit0 = 48,
|
||||
Digit1 = 49,
|
||||
Digit2 = 50,
|
||||
Digit3 = 51,
|
||||
Digit4 = 52,
|
||||
Digit5 = 53,
|
||||
Digit6 = 54,
|
||||
Digit7 = 55,
|
||||
Digit8 = 56,
|
||||
Digit9 = 57,
|
||||
/**
|
||||
* The `:` character.
|
||||
*/
|
||||
Colon = 58,
|
||||
/**
|
||||
* The `;` character.
|
||||
*/
|
||||
Semicolon = 59,
|
||||
/**
|
||||
* The `<` character.
|
||||
*/
|
||||
LessThan = 60,
|
||||
/**
|
||||
* The `=` character.
|
||||
*/
|
||||
Equals = 61,
|
||||
/**
|
||||
* The `>` character.
|
||||
*/
|
||||
GreaterThan = 62,
|
||||
/**
|
||||
* The `?` character.
|
||||
*/
|
||||
QuestionMark = 63,
|
||||
/**
|
||||
* The `@` character.
|
||||
*/
|
||||
AtSign = 64,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
/**
|
||||
* The `[` character.
|
||||
*/
|
||||
OpenSquareBracket = 91,
|
||||
/**
|
||||
* The `\` character.
|
||||
*/
|
||||
Backslash = 92,
|
||||
/**
|
||||
* The `]` character.
|
||||
*/
|
||||
CloseSquareBracket = 93,
|
||||
/**
|
||||
* The `^` character.
|
||||
*/
|
||||
Caret = 94,
|
||||
/**
|
||||
* The `_` character.
|
||||
*/
|
||||
Underline = 95,
|
||||
/**
|
||||
* The ``(`)`` character.
|
||||
*/
|
||||
BackTick = 96,
|
||||
a = 97,
|
||||
b = 98,
|
||||
c = 99,
|
||||
d = 100,
|
||||
e = 101,
|
||||
f = 102,
|
||||
g = 103,
|
||||
h = 104,
|
||||
i = 105,
|
||||
j = 106,
|
||||
k = 107,
|
||||
l = 108,
|
||||
m = 109,
|
||||
n = 110,
|
||||
o = 111,
|
||||
p = 112,
|
||||
q = 113,
|
||||
r = 114,
|
||||
s = 115,
|
||||
t = 116,
|
||||
u = 117,
|
||||
v = 118,
|
||||
w = 119,
|
||||
x = 120,
|
||||
y = 121,
|
||||
z = 122,
|
||||
/**
|
||||
* The `{` character.
|
||||
*/
|
||||
OpenCurlyBrace = 123,
|
||||
/**
|
||||
* The `|` character.
|
||||
*/
|
||||
Pipe = 124,
|
||||
/**
|
||||
* The `}` character.
|
||||
*/
|
||||
CloseCurlyBrace = 125,
|
||||
/**
|
||||
* The `~` character.
|
||||
*/
|
||||
Tilde = 126,
|
||||
U_Combining_Grave_Accent = 768,
|
||||
U_Combining_Acute_Accent = 769,
|
||||
U_Combining_Circumflex_Accent = 770,
|
||||
U_Combining_Tilde = 771,
|
||||
U_Combining_Macron = 772,
|
||||
U_Combining_Overline = 773,
|
||||
U_Combining_Breve = 774,
|
||||
U_Combining_Dot_Above = 775,
|
||||
U_Combining_Diaeresis = 776,
|
||||
U_Combining_Hook_Above = 777,
|
||||
U_Combining_Ring_Above = 778,
|
||||
U_Combining_Double_Acute_Accent = 779,
|
||||
U_Combining_Caron = 780,
|
||||
U_Combining_Vertical_Line_Above = 781,
|
||||
U_Combining_Double_Vertical_Line_Above = 782,
|
||||
U_Combining_Double_Grave_Accent = 783,
|
||||
U_Combining_Candrabindu = 784,
|
||||
U_Combining_Inverted_Breve = 785,
|
||||
U_Combining_Turned_Comma_Above = 786,
|
||||
U_Combining_Comma_Above = 787,
|
||||
U_Combining_Reversed_Comma_Above = 788,
|
||||
U_Combining_Comma_Above_Right = 789,
|
||||
U_Combining_Grave_Accent_Below = 790,
|
||||
U_Combining_Acute_Accent_Below = 791,
|
||||
U_Combining_Left_Tack_Below = 792,
|
||||
U_Combining_Right_Tack_Below = 793,
|
||||
U_Combining_Left_Angle_Above = 794,
|
||||
U_Combining_Horn = 795,
|
||||
U_Combining_Left_Half_Ring_Below = 796,
|
||||
U_Combining_Up_Tack_Below = 797,
|
||||
U_Combining_Down_Tack_Below = 798,
|
||||
U_Combining_Plus_Sign_Below = 799,
|
||||
U_Combining_Minus_Sign_Below = 800,
|
||||
U_Combining_Palatalized_Hook_Below = 801,
|
||||
U_Combining_Retroflex_Hook_Below = 802,
|
||||
U_Combining_Dot_Below = 803,
|
||||
U_Combining_Diaeresis_Below = 804,
|
||||
U_Combining_Ring_Below = 805,
|
||||
U_Combining_Comma_Below = 806,
|
||||
U_Combining_Cedilla = 807,
|
||||
U_Combining_Ogonek = 808,
|
||||
U_Combining_Vertical_Line_Below = 809,
|
||||
U_Combining_Bridge_Below = 810,
|
||||
U_Combining_Inverted_Double_Arch_Below = 811,
|
||||
U_Combining_Caron_Below = 812,
|
||||
U_Combining_Circumflex_Accent_Below = 813,
|
||||
U_Combining_Breve_Below = 814,
|
||||
U_Combining_Inverted_Breve_Below = 815,
|
||||
U_Combining_Tilde_Below = 816,
|
||||
U_Combining_Macron_Below = 817,
|
||||
U_Combining_Low_Line = 818,
|
||||
U_Combining_Double_Low_Line = 819,
|
||||
U_Combining_Tilde_Overlay = 820,
|
||||
U_Combining_Short_Stroke_Overlay = 821,
|
||||
U_Combining_Long_Stroke_Overlay = 822,
|
||||
U_Combining_Short_Solidus_Overlay = 823,
|
||||
U_Combining_Long_Solidus_Overlay = 824,
|
||||
U_Combining_Right_Half_Ring_Below = 825,
|
||||
U_Combining_Inverted_Bridge_Below = 826,
|
||||
U_Combining_Square_Below = 827,
|
||||
U_Combining_Seagull_Below = 828,
|
||||
U_Combining_X_Above = 829,
|
||||
U_Combining_Vertical_Tilde = 830,
|
||||
U_Combining_Double_Overline = 831,
|
||||
U_Combining_Grave_Tone_Mark = 832,
|
||||
U_Combining_Acute_Tone_Mark = 833,
|
||||
U_Combining_Greek_Perispomeni = 834,
|
||||
U_Combining_Greek_Koronis = 835,
|
||||
U_Combining_Greek_Dialytika_Tonos = 836,
|
||||
U_Combining_Greek_Ypogegrammeni = 837,
|
||||
U_Combining_Bridge_Above = 838,
|
||||
U_Combining_Equals_Sign_Below = 839,
|
||||
U_Combining_Double_Vertical_Line_Below = 840,
|
||||
U_Combining_Left_Angle_Below = 841,
|
||||
U_Combining_Not_Tilde_Above = 842,
|
||||
U_Combining_Homothetic_Above = 843,
|
||||
U_Combining_Almost_Equal_To_Above = 844,
|
||||
U_Combining_Left_Right_Arrow_Below = 845,
|
||||
U_Combining_Upwards_Arrow_Below = 846,
|
||||
U_Combining_Grapheme_Joiner = 847,
|
||||
U_Combining_Right_Arrowhead_Above = 848,
|
||||
U_Combining_Left_Half_Ring_Above = 849,
|
||||
U_Combining_Fermata = 850,
|
||||
U_Combining_X_Below = 851,
|
||||
U_Combining_Left_Arrowhead_Below = 852,
|
||||
U_Combining_Right_Arrowhead_Below = 853,
|
||||
U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below = 854,
|
||||
U_Combining_Right_Half_Ring_Above = 855,
|
||||
U_Combining_Dot_Above_Right = 856,
|
||||
U_Combining_Asterisk_Below = 857,
|
||||
U_Combining_Double_Ring_Below = 858,
|
||||
U_Combining_Zigzag_Above = 859,
|
||||
U_Combining_Double_Breve_Below = 860,
|
||||
U_Combining_Double_Breve = 861,
|
||||
U_Combining_Double_Macron = 862,
|
||||
U_Combining_Double_Macron_Below = 863,
|
||||
U_Combining_Double_Tilde = 864,
|
||||
U_Combining_Double_Inverted_Breve = 865,
|
||||
U_Combining_Double_Rightwards_Arrow_Below = 866,
|
||||
U_Combining_Latin_Small_Letter_A = 867,
|
||||
U_Combining_Latin_Small_Letter_E = 868,
|
||||
U_Combining_Latin_Small_Letter_I = 869,
|
||||
U_Combining_Latin_Small_Letter_O = 870,
|
||||
U_Combining_Latin_Small_Letter_U = 871,
|
||||
U_Combining_Latin_Small_Letter_C = 872,
|
||||
U_Combining_Latin_Small_Letter_D = 873,
|
||||
U_Combining_Latin_Small_Letter_H = 874,
|
||||
U_Combining_Latin_Small_Letter_M = 875,
|
||||
U_Combining_Latin_Small_Letter_R = 876,
|
||||
U_Combining_Latin_Small_Letter_T = 877,
|
||||
U_Combining_Latin_Small_Letter_V = 878,
|
||||
U_Combining_Latin_Small_Letter_X = 879,
|
||||
/**
|
||||
* Unicode Character 'LINE SEPARATOR' (U+2028)
|
||||
* http://www.fileformat.info/info/unicode/char/2028/index.htm
|
||||
*/
|
||||
LINE_SEPARATOR = 8232,
|
||||
/**
|
||||
* Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)
|
||||
* http://www.fileformat.info/info/unicode/char/2029/index.htm
|
||||
*/
|
||||
PARAGRAPH_SEPARATOR = 8233,
|
||||
/**
|
||||
* Unicode Character 'NEXT LINE' (U+0085)
|
||||
* http://www.fileformat.info/info/unicode/char/0085/index.htm
|
||||
*/
|
||||
NEXT_LINE = 133,
|
||||
U_CIRCUMFLEX = 94,
|
||||
U_GRAVE_ACCENT = 96,
|
||||
U_DIAERESIS = 168,
|
||||
U_MACRON = 175,
|
||||
U_ACUTE_ACCENT = 180,
|
||||
U_CEDILLA = 184,
|
||||
U_MODIFIER_LETTER_LEFT_ARROWHEAD = 706,
|
||||
U_MODIFIER_LETTER_RIGHT_ARROWHEAD = 707,
|
||||
U_MODIFIER_LETTER_UP_ARROWHEAD = 708,
|
||||
U_MODIFIER_LETTER_DOWN_ARROWHEAD = 709,
|
||||
U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING = 722,
|
||||
U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING = 723,
|
||||
U_MODIFIER_LETTER_UP_TACK = 724,
|
||||
U_MODIFIER_LETTER_DOWN_TACK = 725,
|
||||
U_MODIFIER_LETTER_PLUS_SIGN = 726,
|
||||
U_MODIFIER_LETTER_MINUS_SIGN = 727,
|
||||
U_BREVE = 728,
|
||||
U_DOT_ABOVE = 729,
|
||||
U_RING_ABOVE = 730,
|
||||
U_OGONEK = 731,
|
||||
U_SMALL_TILDE = 732,
|
||||
U_DOUBLE_ACUTE_ACCENT = 733,
|
||||
U_MODIFIER_LETTER_RHOTIC_HOOK = 734,
|
||||
U_MODIFIER_LETTER_CROSS_ACCENT = 735,
|
||||
U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR = 741,
|
||||
U_MODIFIER_LETTER_HIGH_TONE_BAR = 742,
|
||||
U_MODIFIER_LETTER_MID_TONE_BAR = 743,
|
||||
U_MODIFIER_LETTER_LOW_TONE_BAR = 744,
|
||||
U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR = 745,
|
||||
U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK = 746,
|
||||
U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK = 747,
|
||||
U_MODIFIER_LETTER_UNASPIRATED = 749,
|
||||
U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD = 751,
|
||||
U_MODIFIER_LETTER_LOW_UP_ARROWHEAD = 752,
|
||||
U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD = 753,
|
||||
U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD = 754,
|
||||
U_MODIFIER_LETTER_LOW_RING = 755,
|
||||
U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT = 756,
|
||||
U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT = 757,
|
||||
U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT = 758,
|
||||
U_MODIFIER_LETTER_LOW_TILDE = 759,
|
||||
U_MODIFIER_LETTER_RAISED_COLON = 760,
|
||||
U_MODIFIER_LETTER_BEGIN_HIGH_TONE = 761,
|
||||
U_MODIFIER_LETTER_END_HIGH_TONE = 762,
|
||||
U_MODIFIER_LETTER_BEGIN_LOW_TONE = 763,
|
||||
U_MODIFIER_LETTER_END_LOW_TONE = 764,
|
||||
U_MODIFIER_LETTER_SHELF = 765,
|
||||
U_MODIFIER_LETTER_OPEN_SHELF = 766,
|
||||
U_MODIFIER_LETTER_LOW_LEFT_ARROW = 767,
|
||||
U_GREEK_LOWER_NUMERAL_SIGN = 885,
|
||||
U_GREEK_TONOS = 900,
|
||||
U_GREEK_DIALYTIKA_TONOS = 901,
|
||||
U_GREEK_KORONIS = 8125,
|
||||
U_GREEK_PSILI = 8127,
|
||||
U_GREEK_PERISPOMENI = 8128,
|
||||
U_GREEK_DIALYTIKA_AND_PERISPOMENI = 8129,
|
||||
U_GREEK_PSILI_AND_VARIA = 8141,
|
||||
U_GREEK_PSILI_AND_OXIA = 8142,
|
||||
U_GREEK_PSILI_AND_PERISPOMENI = 8143,
|
||||
U_GREEK_DASIA_AND_VARIA = 8157,
|
||||
U_GREEK_DASIA_AND_OXIA = 8158,
|
||||
U_GREEK_DASIA_AND_PERISPOMENI = 8159,
|
||||
U_GREEK_DIALYTIKA_AND_VARIA = 8173,
|
||||
U_GREEK_DIALYTIKA_AND_OXIA = 8174,
|
||||
U_GREEK_VARIA = 8175,
|
||||
U_GREEK_OXIA = 8189,
|
||||
U_GREEK_DASIA = 8190,
|
||||
U_OVERLINE = 8254,
|
||||
/**
|
||||
* UTF-8 BOM
|
||||
* Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF)
|
||||
* http://www.fileformat.info/info/unicode/char/feff/index.htm
|
||||
*/
|
||||
UTF8_BOM = 65279
|
||||
}
|
||||
6
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js
generated
vendored
6
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export {};
|
||||
//# sourceMappingURL=charCode.js.map
|
||||
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js.map
generated
vendored
1
node_modules/yaml-language-server/lib/esm/languageservice/utils/charCode.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"charCode.js","sourceRoot":"","sources":["../../../../src/languageservice/utils/charCode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Position } from 'vscode-languageserver-types';
|
||||
export declare function insertionPointReturnValue(pt: number): number;
|
||||
export declare function binarySearch(array: number[], sought: number): number;
|
||||
export declare function getLineStartPositions(text: string): number[];
|
||||
export declare function getPosition(pos: number, lineStartPositions: number[]): Position;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user