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