@microsoft/powerquery-language-services 0.6.1 → 0.6.2

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,4 +1,5 @@
1
1
  import * as PQF from "@microsoft/powerquery-formatter";
2
+ import * as PQP from "@microsoft/powerquery-parser";
2
3
  import { TextEdit } from "vscode-languageserver-types";
3
4
  import { TextDocument } from "vscode-languageserver-textdocument";
4
- export declare function tryFormat(document: TextDocument, settings: PQF.FormatSettings): Promise<TextEdit[]>;
5
+ export declare function tryFormat(document: TextDocument, settings: PQF.FormatSettings): Promise<PQP.Result<TextEdit[] | undefined, PQP.CommonError.CommonError>>;
@@ -17,7 +17,7 @@ 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
19
  function tryFormat(document, settings) {
20
- return __awaiter(this, void 0, void 0, function* () {
20
+ return powerquery_parser_1.ResultUtils.ensureResultAsync(() => __awaiter(this, void 0, void 0, function* () {
21
21
  const formatSettings = Object.assign(Object.assign({}, PQF.DefaultSettings), settings);
22
22
  const triedFormat = yield PQF.tryFormat(formatSettings, document.getText());
23
23
  if (powerquery_parser_1.ResultUtils.isOk(triedFormat)) {
@@ -25,13 +25,13 @@ function tryFormat(document, settings) {
25
25
  }
26
26
  // If an unhandled exception was returned.
27
27
  else if (PQP.CommonError.isCommonError(triedFormat.error)) {
28
- throw triedFormat.error;
28
+ throw triedFormat;
29
29
  }
30
30
  // Else a lexer or parser error was returned and should be ignored.
31
31
  else {
32
- return [];
32
+ return undefined;
33
33
  }
34
- });
34
+ }), settings.locale);
35
35
  }
36
36
  exports.tryFormat = tryFormat;
37
37
  // TODO: is there a better way to do this?
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/powerquery-language-services/formatter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;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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;SACrB;QACD,mEAAmE;aAC9D;YACD,OAAO,SAAS,CAAC;SACpB;IACL,CAAC,CAAA,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAxBD,8BAwBC;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/powerquery-language-services",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "author": "Microsoft",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -49,7 +49,7 @@
49
49
  "typescript": "4.6.4"
50
50
  },
51
51
  "dependencies": {
52
- "@microsoft/powerquery-formatter": "0.3.0",
52
+ "@microsoft/powerquery-formatter": "0.3.1",
53
53
  "@microsoft/powerquery-parser": "0.10.0",
54
54
  "vscode-languageserver-textdocument": "1.0.4",
55
55
  "vscode-languageserver-types": "3.17.1"