Skip to content

Commit 0299169

Browse files
authored
build: update pretter to 2.x (#87)
1 parent 0724e4e commit 0299169

File tree

82 files changed

+1062
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1062
-1056
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
require: ["source-map-support/register"],
3-
spec: "./lib/test/**/*spec.js"
3+
spec: "./lib/test/**/*spec.js",
44
};

nyc.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ module.exports = {
66
branches: 100,
77
lines: 100,
88
functions: 100,
9-
statements: 100
9+
statements: 100,
1010
};

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"mocha": "7.1.2",
4848
"npm-run-all": "4.1.5",
4949
"nyc": "15.0.1",
50-
"prettier": "1.19.1",
50+
"prettier": "2.0.5",
5151
"source-map-support": "0.5.19",
5252
"typescript": "3.8.3",
5353
"cz-conventional-changelog": "3.1.0",
@@ -57,9 +57,6 @@
5757
"@types/rimraf": "3.0.0",
5858
"simple-git": "1.132.0"
5959
},
60-
"prettier": {
61-
"endOfLine": "lf"
62-
},
6360
"husky": {
6461
"hooks": {
6562
"pre-commit": "lint-staged",

packages/language-server/src/completion-items.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
TextDocumentPositionParams,
66
InsertTextFormat,
77
TextEdit,
8-
Range
8+
Range,
99
} from "vscode-languageserver";
1010
import { TextDocument } from "vscode-languageserver-textdocument";
1111
import { Position } from "vscode-languageserver-types";
@@ -16,25 +16,25 @@ import {
1616
SourcePosition,
1717
XMLAttribute,
1818
XMLElement,
19-
XMLDocument
19+
XMLDocument,
2020
} from "@xml-tools/ast";
2121
import {
2222
UI5SemanticModel,
2323
BaseUI5Node,
2424
UI5Prop,
2525
UI5Aggregation,
2626
UI5Association,
27-
UI5Field
27+
UI5Field,
2828
} from "@ui5-language-assistant/semantic-model-types";
2929
import {
3030
getXMLViewCompletions,
3131
UI5XMLViewCompletion,
32-
UI5ClassesInXMLTagNameCompletion
32+
UI5ClassesInXMLTagNameCompletion,
3333
} from "@ui5-language-assistant/xml-views-completion";
3434
import {
3535
ui5NodeToFQN,
3636
isRootSymbol,
37-
typeToString
37+
typeToString,
3838
} from "@ui5-language-assistant/logic-utils";
3939
import { getNodeDocumentation } from "./documentation";
4040

@@ -51,7 +51,7 @@ export function getCompletionItems(
5151
offset: document.offsetAt(textDocumentPosition.position),
5252
cst: cst as DocumentCstNode,
5353
ast: ast,
54-
tokenVector: tokenVector
54+
tokenVector: tokenVector,
5555
});
5656

5757
const completionItems = transformToLspSuggestions(
@@ -67,7 +67,7 @@ function transformToLspSuggestions(
6767
model: UI5SemanticModel,
6868
originalPosition: Position
6969
): CompletionItem[] {
70-
const lspSuggestions = map(suggestions, suggestion => {
70+
const lspSuggestions = map(suggestions, (suggestion) => {
7171
const lspKind = computeLSPKind(suggestion);
7272
let detailText = getNodeDetail(suggestion.ui5Node);
7373
if (suggestion.ui5Node.experimentalInfo?.isExperimental) {
@@ -86,7 +86,7 @@ function transformToLspSuggestions(
8686
additionalTextEdits: textEditDetails.additionalTextEdits,
8787
detail: detailText,
8888
documentation: getNodeDocumentation(suggestion.ui5Node, model),
89-
kind: lspKind
89+
kind: lspKind,
9090
// TODO tags are not supported in Theia: https://che-incubator.github.io/vscode-theia-comparator/status.html
9191
// tags: suggestion.ui5Node.deprecatedInfo?.isDeprecated
9292
// ? [CompletionItemTag.Deprecated]
@@ -130,7 +130,7 @@ function createTextEdits(
130130
const additionalTextEdits: TextEdit[] = [];
131131
let range: Range = {
132132
start: originalPosition,
133-
end: originalPosition
133+
end: originalPosition,
134134
};
135135
let newText = suggestion.ui5Node.name;
136136

@@ -240,10 +240,10 @@ function createTextEdits(
240240
return {
241241
textEdit: {
242242
range,
243-
newText
243+
newText,
244244
},
245245
filterText,
246-
additionalTextEdits
246+
additionalTextEdits,
247247
};
248248
}
249249

@@ -312,7 +312,7 @@ function getClosingTagTextEdits(
312312
if (closingTagNameRange !== undefined) {
313313
const closingTagNameTextEdit = {
314314
newText: closingTagName,
315-
range: closingTagNameRange
315+
range: closingTagNameRange,
316316
};
317317
textEdits.push(closingTagNameTextEdit);
318318
}
@@ -327,7 +327,7 @@ function getClosingTagTextEdits(
327327
if (closingTagRange !== undefined) {
328328
const closingTagTextEdit = {
329329
newText: `</${closingTagName}>`,
330-
range: closingTagRange
330+
range: closingTagRange,
331331
};
332332
textEdits.push(closingTagTextEdit);
333333
}
@@ -374,7 +374,7 @@ function rangeContains(range: Range, inner: Range): boolean {
374374
function createInsertRange(line: number, column: number): Range {
375375
return {
376376
start: Position.create(line - 1, column),
377-
end: Position.create(line - 1, column)
377+
end: Position.create(line - 1, column),
378378
};
379379
}
380380

@@ -389,7 +389,7 @@ function positionToRange(
389389
if (position !== undefined && !isDummyPosition(position)) {
390390
return {
391391
start: Position.create(position.startLine - 1, position.startColumn - 1),
392-
end: Position.create(position.endLine - 1, position.endColumn)
392+
end: Position.create(position.endLine - 1, position.endColumn),
393393
};
394394
}
395395
return undefined;
@@ -404,7 +404,7 @@ function getClassNamespacePrefix(
404404
/* istanbul ignore else */
405405
if (parent !== undefined) {
406406
const parentFQN = ui5NodeToFQN(parent);
407-
let xmlnsPrefix = findKey(xmlElement.namespaces, _ => _ === parentFQN);
407+
let xmlnsPrefix = findKey(xmlElement.namespaces, (_) => _ === parentFQN);
408408
// Namespace not defined in imports - guess it
409409
if (xmlnsPrefix === undefined) {
410410
// It should be the parent simple name by default, but if that already exists we'll add an index to it (name2 etc)
@@ -460,7 +460,7 @@ function getAddNamespaceEdit(
460460
const range = createInsertRange(position.endLine, position.endColumn);
461461
return {
462462
range,
463-
newText: ` xmlns:${xmlns}="${value}"`
463+
newText: ` xmlns:${xmlns}="${value}"`,
464464
};
465465
}
466466
// See above for why this case is ignored.

packages/language-server/src/documentation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {
22
UI5SemanticModel,
3-
BaseUI5Node
3+
BaseUI5Node,
44
} from "@ui5-language-assistant/semantic-model-types";
55
import { MarkupContent } from "vscode-languageserver";
66
import {
77
getRootSymbolParent,
8-
ui5NodeToFQN
8+
ui5NodeToFQN,
99
} from "@ui5-language-assistant/logic-utils";
1010
import { GENERATED_LIBRARY } from "@ui5-language-assistant/semantic-model";
1111

@@ -137,7 +137,7 @@ function convertDescriptionToMarkup(
137137

138138
return {
139139
kind: "markdown",
140-
value: contents
140+
value: contents,
141141
};
142142
}
143143

packages/language-server/src/server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
ProposedFeatures,
77
TextDocumentPositionParams,
88
CompletionItem,
9-
InitializeParams
9+
InitializeParams,
1010
} from "vscode-languageserver";
1111
import { TextDocument } from "vscode-languageserver-textdocument";
1212
import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types";
@@ -30,9 +30,9 @@ connection.onInitialize((params: InitializeParams) => {
3030
resolveProvider: true,
3131
// TODO: can the trigger characters be more contextual?
3232
// e.g: "<" of open tag only, not else where
33-
triggerCharacters: ['"', "'", ":", "<"]
34-
}
35-
}
33+
triggerCharacters: ['"', "'", ":", "<"],
34+
},
35+
},
3636
};
3737
});
3838

@@ -64,7 +64,7 @@ connection.onCompletionResolve(
6464
}
6565
);
6666

67-
documents.onDidChangeContent(async changeEvent => {
67+
documents.onDidChangeContent(async (changeEvent) => {
6868
if (getSemanticModelPromise === undefined) {
6969
return;
7070
}

packages/language-server/src/ui5-model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types";
77
import {
88
generate,
99
Json,
10-
TypeNameFix
10+
TypeNameFix,
1111
} from "@ui5-language-assistant/semantic-model";
1212
import { Fetcher } from "../api";
1313

@@ -49,7 +49,7 @@ export async function getSemanticModelWithFetcher(
4949
}
5050

5151
await Promise.all(
52-
map(libs, async libName => {
52+
map(libs, async (libName) => {
5353
const cacheFilePath = getCacheFilePath(cacheFolder, libName);
5454
let apiJson = await readFromCache(cacheFilePath);
5555
// If the file doesn't exist in the cache (or we couldn't read it), fetch it from the network
@@ -74,7 +74,7 @@ export async function getSemanticModelWithFetcher(
7474
libraries: jsonMap,
7575
typeNameFix: getTypeNameFix(),
7676
strict: false,
77-
printValidationErrors: false
77+
printValidationErrors: false,
7878
});
7979
}
8080

@@ -154,7 +154,7 @@ function getTypeNameFix(): TypeNameFix {
154154
"sap.ui.vk.AnimationTimeSlider": undefined,
155155
"sap.ui.vk.SelectionMode": undefined,
156156
"sap.ui.vk.RenderMode": undefined,
157-
"sap.viz.ui5.controls.VizRangeSlider": undefined
157+
"sap.viz.ui5.controls.VizRangeSlider": undefined,
158158
};
159159
return fixes;
160160
}
@@ -211,6 +211,6 @@ function getLibs(): string[] {
211211
"sap.ushell",
212212
"sap.uxap",
213213
"sap.viz",
214-
"sap.zen.commons"
214+
"sap.zen.commons",
215215
];
216216
}

packages/language-server/src/xml-view-diagnostics.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { assertNever } from "assert-never";
44
import {
55
Diagnostic,
66
DiagnosticSeverity,
7-
DiagnosticTag
7+
DiagnosticTag,
88
} from "vscode-languageserver-types";
99
import { TextDocument } from "vscode-languageserver-textdocument";
1010
import { DocumentCstNode, parse } from "@xml-tools/parser";
@@ -13,7 +13,7 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types";
1313
import {
1414
UI5XMLViewIssue,
1515
validateXMLView,
16-
XMLViewIssueSeverity
16+
XMLViewIssueSeverity,
1717
} from "@ui5-language-assistant/xml-views-validation";
1818

1919
export function getXMLViewDiagnostics(opts: {
@@ -25,7 +25,7 @@ export function getXMLViewDiagnostics(opts: {
2525
const xmlDocAst = buildAst(cst as DocumentCstNode, tokenVector);
2626
const issues = validateXMLView({
2727
xmlView: xmlDocAst,
28-
model: opts.ui5Model
28+
model: opts.ui5Model,
2929
});
3030
const diagnostics = validationIssuesToLspDiagnostics(issues, opts.document);
3131
return diagnostics;
@@ -35,28 +35,28 @@ function validationIssuesToLspDiagnostics(
3535
issues: UI5XMLViewIssue[],
3636
document: TextDocument
3737
): Diagnostic[] {
38-
const diagnostics: Diagnostic[] = map(issues, currIssue => {
38+
const diagnostics: Diagnostic[] = map(issues, (currIssue) => {
3939
const commonDiagnosticPros: Diagnostic = {
4040
range: {
4141
start: document.positionAt(currIssue.offsetRange.start),
4242
// Chevrotain's end offsets are none inclusive
43-
end: document.positionAt(currIssue.offsetRange.end + 1)
43+
end: document.positionAt(currIssue.offsetRange.end + 1),
4444
},
4545
severity: toLspSeverity(currIssue.severity),
4646
source: "UI5 Language Assistant",
47-
message: currIssue.message
47+
message: currIssue.message,
4848
};
4949

5050
const issueKind = currIssue.kind;
5151
switch (issueKind) {
5252
case "UnknownEnumValue":
5353
return {
54-
...commonDiagnosticPros
54+
...commonDiagnosticPros,
5555
};
5656
case "UseOfDeprecatedClass":
5757
return {
5858
...commonDiagnosticPros,
59-
tags: [DiagnosticTag.Deprecated]
59+
tags: [DiagnosticTag.Deprecated],
6060
};
6161
/* istanbul ignore next - defensive programming */
6262
default:

0 commit comments

Comments
 (0)