|
1 | | -import process from "process"; |
2 | | -import * as p from "vscode-languageserver-protocol"; |
3 | | -import * as v from "vscode-languageserver"; |
4 | | -import * as rpc from "vscode-jsonrpc/node"; |
5 | | -import * as path from "path"; |
6 | | -import semver from "semver"; |
7 | 1 | import fs from "fs"; |
8 | 2 | import fsAsync from "fs/promises"; |
| 3 | +import * as path from "path"; |
| 4 | +import process from "process"; |
| 5 | +import semver from "semver"; |
| 6 | +import * as rpc from "vscode-jsonrpc/node"; |
| 7 | +import * as v from "vscode-languageserver"; |
| 8 | +import { WorkspaceEdit } from "vscode-languageserver"; |
| 9 | +import * as p from "vscode-languageserver-protocol"; |
9 | 10 | import { |
10 | | - DidChangeWatchedFilesNotification, |
11 | | - DidOpenTextDocumentNotification, |
| 11 | + CodeLensParams, |
| 12 | + DidChangeConfigurationNotification, |
12 | 13 | DidChangeTextDocumentNotification, |
| 14 | + DidChangeWatchedFilesNotification, |
13 | 15 | DidCloseTextDocumentNotification, |
14 | | - DidChangeConfigurationNotification, |
| 16 | + DidOpenTextDocumentNotification, |
| 17 | + InitializedNotification, |
15 | 18 | InitializeParams, |
16 | 19 | InlayHintParams, |
17 | | - CodeLensParams, |
18 | 20 | SignatureHelpParams, |
19 | | - InitializedNotification, |
20 | 21 | } from "vscode-languageserver-protocol"; |
21 | | -import * as lookup from "./lookup"; |
22 | | -import * as utils from "./utils"; |
23 | 22 | import * as codeActions from "./codeActions"; |
| 23 | +import config, { extensionConfiguration, initialConfiguration } from "./config"; |
24 | 24 | import * as c from "./constants"; |
25 | | -import { assert } from "console"; |
26 | | -import { WorkspaceEdit } from "vscode-languageserver"; |
27 | 25 | import { onErrorReported } from "./errorReporter"; |
28 | 26 | import * as ic from "./incrementalCompilation"; |
29 | | -import config, { extensionConfiguration, initialConfiguration } from "./config"; |
| 27 | +import { getLogger, initializeLogger, setLogLevel } from "./logger"; |
| 28 | +import * as lookup from "./lookup"; |
30 | 29 | import { projectsFiles } from "./projectFiles"; |
| 30 | +import * as utils from "./utils"; |
31 | 31 | import { NormalizedPath } from "./utils"; |
32 | | -import { initializeLogger, getLogger, setLogLevel } from "./logger"; |
33 | | - |
34 | | -function applyUserConfiguration(configuration: extensionConfiguration) { |
35 | | - // We always want to spread the initial configuration to ensure all defaults are respected. |
36 | | - config.extensionConfiguration = Object.assign( |
37 | | - {}, |
38 | 32 | initialConfiguration, |
39 | 33 | configuration, |
40 | 34 | ); |
@@ -1523,41 +1517,35 @@ async function onMessage(msg: p.Message) { |
1523 | 1517 | The client can watch files for us and send us events via the `workspace/didChangeWatchedFiles` |
1524 | 1518 | */ |
1525 | 1519 | const watchers = Array.from(workspaceFolders).flatMap( |
1526 | | - (projectRootPath) => { |
1527 | | - return [ |
1528 | | - { |
1529 | | - // Only watch the root compiler log for each workspace folder. |
1530 | | - // In monorepos, `**/lib/bs/.compiler.log` matches every package and dependency, |
1531 | | - // causing a burst of events per save. |
1532 | | - globPattern: { |
1533 | | - baseUri: utils.pathToURI(projectRootPath), |
1534 | | - pattern: c.compilerLogPartialPath, |
1535 | | - }, |
1536 | | - kind: |
1537 | | - p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1520 | + (projectRootPath) => [ |
| 1521 | + { |
| 1522 | + // Only watch the root compiler log for each workspace folder. |
| 1523 | + // In monorepos, `**/lib/bs/.compiler.log` matches every package and dependency, |
| 1524 | + // causing a burst of events per save. |
| 1525 | + globPattern: { |
| 1526 | + baseUri: utils.pathToURI(projectRootPath), |
| 1527 | + pattern: c.compilerLogPartialPath, |
1538 | 1528 | }, |
1539 | | - { |
1540 | | - // Watch build artifacts |
1541 | | - globPattern: { |
1542 | | - baseUri: utils.pathToURI(projectRootPath), |
1543 | | - pattern: path.join(c.compilerDirPartialPath, "**/*.{cmi,cmt}"), |
1544 | | - }, |
1545 | | - kind: |
1546 | | - p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1529 | + kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1530 | + }, |
| 1531 | + { |
| 1532 | + // Watch ninja output |
| 1533 | + globPattern: { |
| 1534 | + baseUri: utils.pathToURI(projectRootPath), |
| 1535 | + pattern: path.join("**", c.buildNinjaPartialPath), |
1547 | 1536 | }, |
1548 | | - { |
1549 | | - // Watch ninja output |
1550 | | - globPattern: { |
1551 | | - baseUri: utils.pathToURI(projectRootPath), |
1552 | | - pattern: path.join("**", c.buildNinjaPartialPath), |
1553 | | - }, |
1554 | | - kind: |
1555 | | - p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1537 | + kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1538 | + }, |
| 1539 | + { |
| 1540 | + // Watch build artifacts |
| 1541 | + globPattern: { |
| 1542 | + baseUri: utils.pathToURI(projectRootPath), |
| 1543 | + pattern: path.join(c.compilerDirPartialPath, "**/*.{cmi,cmt}"), |
1556 | 1544 | }, |
1557 | | - ]; |
1558 | | - }, |
| 1545 | + kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, |
| 1546 | + }, |
| 1547 | + ], |
1559 | 1548 | ); |
1560 | | - |
1561 | 1549 | const registrationParams: p.RegistrationParams = { |
1562 | 1550 | registrations: [ |
1563 | 1551 | { |
|
0 commit comments