@microsoft/powerquery-language-services 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as PQF from "@microsoft/powerquery-formatter";
|
|
2
|
+
import { TextEdit } from "vscode-languageserver-types";
|
|
2
3
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
-
export declare function tryFormat(document: TextDocument,
|
|
4
|
+
export declare function tryFormat(document: TextDocument, settings: PQF.FormatSettings): Promise<TextEdit[]>;
|
|
@@ -16,17 +16,9 @@ const PQF = require("@microsoft/powerquery-formatter");
|
|
|
16
16
|
const PQP = require("@microsoft/powerquery-parser");
|
|
17
17
|
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
18
18
|
const powerquery_parser_1 = require("@microsoft/powerquery-parser");
|
|
19
|
-
function tryFormat(document,
|
|
19
|
+
function tryFormat(document, settings) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
if (formattingOptions.insertSpaces) {
|
|
23
|
-
indentationLiteral = " " /* SpaceX4 */;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
indentationLiteral = "\t" /* Tab */;
|
|
27
|
-
}
|
|
28
|
-
const formatSettings = Object.assign(Object.assign({}, PQF.DefaultSettings), { locale,
|
|
29
|
-
indentationLiteral });
|
|
21
|
+
const formatSettings = Object.assign(Object.assign({}, PQF.DefaultSettings), settings);
|
|
30
22
|
const triedFormat = yield PQF.tryFormat(formatSettings, document.getText());
|
|
31
23
|
if (powerquery_parser_1.ResultUtils.isOk(triedFormat)) {
|
|
32
24
|
return [vscode_languageserver_types_1.TextEdit.replace(fullDocumentRange(document), triedFormat.value)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/powerquery-language-services/formatter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;AAElC,uDAAuD;AACvD,oDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/powerquery-language-services/formatter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;AAElC,uDAAuD;AACvD,oDAAoD;AACpD,6EAA8D;AAC9D,oEAA2D;AAG3D,SAAsB,SAAS,CAAC,QAAsB,EAAE,QAA4B;;QAChF,MAAM,cAAc,mCACb,GAAG,CAAC,eAAe,GACnB,QAAQ,CACd,CAAC;QAEF,MAAM,WAAW,GAAoB,MAAM,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7F,IAAI,+BAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC/B,OAAO,CAAC,sCAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7E;QACD,0CAA0C;aACrC,IAAI,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;YACvD,MAAM,WAAW,CAAC,KAAK,CAAC;SAC3B;QACD,mEAAmE;aAC9D;YACD,OAAO,EAAE,CAAC;SACb;IACL,CAAC;CAAA;AAnBD,8BAmBC;AAED,0CAA0C;AAC1C,SAAS,iBAAiB,CAAC,QAAsB;IAC7C,OAAO;QACH,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7B,GAAG,EAAE;YACD,IAAI,EAAE,QAAQ,CAAC,SAAS,GAAG,CAAC;YAC5B,SAAS,EAAE,MAAM,CAAC,SAAS;SAC9B;KACJ,CAAC;AACN,CAAC"}
|