mirror of
https://github.com/danbulant/monaco-yaml
synced 2026-05-24 12:21:53 +00:00
100 lines
2.1 KiB
TypeScript
100 lines
2.1 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Red Hat. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { DocumentSymbol, SymbolKind } from 'vscode-languageserver-types';
|
|
|
|
export function createExpectedError(
|
|
message: string,
|
|
startLine: number,
|
|
startCharacter: number,
|
|
endLine: number,
|
|
endCharacter: number,
|
|
severity: number = 2
|
|
) {
|
|
return {
|
|
message,
|
|
range: {
|
|
start: {
|
|
line: startLine,
|
|
character: startCharacter,
|
|
},
|
|
end: {
|
|
line: endLine,
|
|
character: endCharacter,
|
|
},
|
|
},
|
|
severity,
|
|
};
|
|
}
|
|
|
|
export function createExpectedSymbolInformation(
|
|
name: string,
|
|
kind: number,
|
|
containerName: string | undefined,
|
|
uri: string,
|
|
startLine: number,
|
|
startCharacter: number,
|
|
endLine: number,
|
|
endCharacter: number
|
|
) {
|
|
return {
|
|
name,
|
|
kind,
|
|
containerName: containerName || '',
|
|
location: {
|
|
uri,
|
|
range: {
|
|
start: {
|
|
line: startLine,
|
|
character: startCharacter,
|
|
},
|
|
end: {
|
|
line: endLine,
|
|
character: endCharacter,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
export function createExpectedDocumentSymbol(
|
|
name: string,
|
|
kind: SymbolKind,
|
|
startLine: number,
|
|
startCharacter: number,
|
|
endLine: number,
|
|
endCharacter: number,
|
|
startLineSelection: number,
|
|
startCharacterSelection: number,
|
|
endLineSelection: number,
|
|
endCharacterSelection: number,
|
|
children: DocumentSymbol[] = []
|
|
): DocumentSymbol {
|
|
return {
|
|
name,
|
|
kind,
|
|
range: {
|
|
start: {
|
|
character: startCharacter,
|
|
line: startLine,
|
|
},
|
|
end: {
|
|
character: endCharacter,
|
|
line: endLine,
|
|
},
|
|
},
|
|
selectionRange: {
|
|
start: {
|
|
character: startCharacterSelection,
|
|
line: startLineSelection,
|
|
},
|
|
end: {
|
|
character: endCharacterSelection,
|
|
line: endLineSelection,
|
|
},
|
|
},
|
|
children,
|
|
};
|
|
}
|