@parcel/lsp 2.12.1-dev.3262 → 2.12.1-dev.3264

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/LspServer.js +55 -55
  2. package/package.json +4 -4
package/lib/LspServer.js CHANGED
@@ -19,28 +19,28 @@ var $ke4eu$parcellspprotocol = require("@parcel/lsp-protocol");
19
19
 
20
20
 
21
21
 
22
- const $19b0115754d0e244$var$connection = (0, $ke4eu$vscodelanguageservernode.createConnection)((0, $ke4eu$vscodelanguageservernode.ProposedFeatures).all);
23
- const $19b0115754d0e244$var$WORKSPACE_ROOT = process.cwd();
24
- const $19b0115754d0e244$var$LSP_SENTINEL_FILENAME = "lsp-server";
22
+ const $78bfd81322641e96$var$connection = (0, $ke4eu$vscodelanguageservernode.createConnection)((0, $ke4eu$vscodelanguageservernode.ProposedFeatures).all);
23
+ const $78bfd81322641e96$var$WORKSPACE_ROOT = process.cwd();
24
+ const $78bfd81322641e96$var$LSP_SENTINEL_FILENAME = "lsp-server";
25
25
  // Create a simple text document manager.
26
26
  // const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
27
- let $19b0115754d0e244$var$hasConfigurationCapability = false;
28
- let $19b0115754d0e244$var$hasWorkspaceFolderCapability = false;
27
+ let $78bfd81322641e96$var$hasConfigurationCapability = false;
28
+ let $78bfd81322641e96$var$hasWorkspaceFolderCapability = false;
29
29
  // let hasDiagnosticRelatedInformationCapability = false;
30
- let $19b0115754d0e244$var$hasDiagnosticsRefreshSupport = false;
31
- $19b0115754d0e244$var$connection.onInitialize((params)=>{
30
+ let $78bfd81322641e96$var$hasDiagnosticsRefreshSupport = false;
31
+ $78bfd81322641e96$var$connection.onInitialize((params)=>{
32
32
  var _capabilities_workspace_diagnostics, _capabilities_workspace;
33
33
  const capabilities = params.capabilities;
34
34
  // Does the client support the `workspace/configuration` request?
35
35
  // If not, we fall back using global settings.
36
- $19b0115754d0e244$var$hasConfigurationCapability = !!(capabilities.workspace && !!capabilities.workspace.configuration);
37
- $19b0115754d0e244$var$hasWorkspaceFolderCapability = !!(capabilities.workspace && !!capabilities.workspace.workspaceFolders);
36
+ $78bfd81322641e96$var$hasConfigurationCapability = !!(capabilities.workspace && !!capabilities.workspace.configuration);
37
+ $78bfd81322641e96$var$hasWorkspaceFolderCapability = !!(capabilities.workspace && !!capabilities.workspace.workspaceFolders);
38
38
  // hasDiagnosticRelatedInformationCapability = !!(
39
39
  // capabilities.textDocument &&
40
40
  // capabilities.textDocument.publishDiagnostics &&
41
41
  // capabilities.textDocument.publishDiagnostics.relatedInformation
42
42
  // );
43
- $19b0115754d0e244$var$hasDiagnosticsRefreshSupport = Boolean((_capabilities_workspace = capabilities.workspace) === null || _capabilities_workspace === void 0 ? void 0 : (_capabilities_workspace_diagnostics = _capabilities_workspace.diagnostics) === null || _capabilities_workspace_diagnostics === void 0 ? void 0 : _capabilities_workspace_diagnostics.refreshSupport);
43
+ $78bfd81322641e96$var$hasDiagnosticsRefreshSupport = Boolean((_capabilities_workspace = capabilities.workspace) === null || _capabilities_workspace === void 0 ? void 0 : (_capabilities_workspace_diagnostics = _capabilities_workspace.diagnostics) === null || _capabilities_workspace_diagnostics === void 0 ? void 0 : _capabilities_workspace_diagnostics.refreshSupport);
44
44
  const result = {
45
45
  capabilities: {
46
46
  textDocumentSync: (0, $ke4eu$vscodelanguageservernode.TextDocumentSyncKind).Incremental,
@@ -51,31 +51,31 @@ $19b0115754d0e244$var$connection.onInitialize((params)=>{
51
51
  }
52
52
  }
53
53
  };
54
- if ($19b0115754d0e244$var$hasWorkspaceFolderCapability) result.capabilities.workspace = {
54
+ if ($78bfd81322641e96$var$hasWorkspaceFolderCapability) result.capabilities.workspace = {
55
55
  workspaceFolders: {
56
56
  supported: true
57
57
  }
58
58
  };
59
59
  return result;
60
60
  });
61
- $19b0115754d0e244$var$connection.onInitialized(()=>{
62
- if ($19b0115754d0e244$var$hasConfigurationCapability) // Register for all configuration changes.
63
- $19b0115754d0e244$var$connection.client.register((0, $ke4eu$vscodelanguageservernode.DidChangeConfigurationNotification).type, undefined);
64
- if ($19b0115754d0e244$var$hasWorkspaceFolderCapability) $19b0115754d0e244$var$connection.workspace.onDidChangeWorkspaceFolders(()=>{
65
- $19b0115754d0e244$var$connection.console.log("Workspace folder change event received.");
61
+ $78bfd81322641e96$var$connection.onInitialized(()=>{
62
+ if ($78bfd81322641e96$var$hasConfigurationCapability) // Register for all configuration changes.
63
+ $78bfd81322641e96$var$connection.client.register((0, $ke4eu$vscodelanguageservernode.DidChangeConfigurationNotification).type, undefined);
64
+ if ($78bfd81322641e96$var$hasWorkspaceFolderCapability) $78bfd81322641e96$var$connection.workspace.onDidChangeWorkspaceFolders(()=>{
65
+ $78bfd81322641e96$var$connection.console.log("Workspace folder change event received.");
66
66
  });
67
67
  });
68
68
  // Proxy
69
- $19b0115754d0e244$var$connection.onRequest((0, $ke4eu$parcellspprotocol.RequestImporters), async (params)=>{
70
- let client = $19b0115754d0e244$var$findClient(params);
69
+ $78bfd81322641e96$var$connection.onRequest((0, $ke4eu$parcellspprotocol.RequestImporters), async (params)=>{
70
+ let client = $78bfd81322641e96$var$findClient(params);
71
71
  if (client) {
72
72
  let result = await client.connection.sendRequest((0, $ke4eu$parcellspprotocol.RequestImporters), params);
73
73
  return result;
74
74
  }
75
75
  return null;
76
76
  });
77
- $19b0115754d0e244$var$connection.onRequest((0, $ke4eu$vscodelanguageservernode.DocumentDiagnosticRequest).type, async (params)=>{
78
- let client = $19b0115754d0e244$var$findClient(params.textDocument.uri);
77
+ $78bfd81322641e96$var$connection.onRequest((0, $ke4eu$vscodelanguageservernode.DocumentDiagnosticRequest).type, async (params)=>{
78
+ let client = $78bfd81322641e96$var$findClient(params.textDocument.uri);
79
79
  let result;
80
80
  if (client) {
81
81
  // console.log(
@@ -96,11 +96,11 @@ $19b0115754d0e244$var$connection.onRequest((0, $ke4eu$vscodelanguageservernode.D
96
96
  items: result !== null && result !== void 0 ? result : []
97
97
  };
98
98
  });
99
- $19b0115754d0e244$var$connection.listen();
100
- class $19b0115754d0e244$var$ProgressReporter {
99
+ $78bfd81322641e96$var$connection.listen();
100
+ class $78bfd81322641e96$var$ProgressReporter {
101
101
  begin() {
102
102
  this.progressReporterPromise = (async ()=>{
103
- let reporter = await $19b0115754d0e244$var$connection.window.createWorkDoneProgress();
103
+ let reporter = await $78bfd81322641e96$var$connection.window.createWorkDoneProgress();
104
104
  reporter.begin("Parcel");
105
105
  return reporter;
106
106
  })();
@@ -124,16 +124,16 @@ class $19b0115754d0e244$var$ProgressReporter {
124
124
  }
125
125
  }
126
126
  }
127
- function $19b0115754d0e244$var$sendDiagnosticsRefresh() {
128
- if ($19b0115754d0e244$var$hasDiagnosticsRefreshSupport) $19b0115754d0e244$var$connection.sendRequest((0, $ke4eu$vscodelanguageservernode.DiagnosticRefreshRequest).type);
127
+ function $78bfd81322641e96$var$sendDiagnosticsRefresh() {
128
+ if ($78bfd81322641e96$var$hasDiagnosticsRefreshSupport) $78bfd81322641e96$var$connection.sendRequest((0, $ke4eu$vscodelanguageservernode.DiagnosticRefreshRequest).type);
129
129
  }
130
- let $19b0115754d0e244$var$progressReporter = new $19b0115754d0e244$var$ProgressReporter();
131
- let $19b0115754d0e244$var$clients = new Map();
132
- function $19b0115754d0e244$var$findClient(document) {
130
+ let $78bfd81322641e96$var$progressReporter = new $78bfd81322641e96$var$ProgressReporter();
131
+ let $78bfd81322641e96$var$clients = new Map();
132
+ function $78bfd81322641e96$var$findClient(document) {
133
133
  let filepath = $ke4eu$url.fileURLToPath(document);
134
134
  let longestPrefix = 0;
135
135
  let bestClient;
136
- for (let [, client] of $19b0115754d0e244$var$clients){
136
+ for (let [, client] of $78bfd81322641e96$var$clients){
137
137
  let prefix = $ke4eu$commonpathprefix([
138
138
  client.projectRoot,
139
139
  filepath
@@ -145,11 +145,11 @@ function $19b0115754d0e244$var$findClient(document) {
145
145
  }
146
146
  return bestClient;
147
147
  }
148
- function $19b0115754d0e244$var$loadMetafile(filepath) {
148
+ function $78bfd81322641e96$var$loadMetafile(filepath) {
149
149
  const file = $ke4eu$fs.readFileSync(filepath, "utf-8");
150
150
  return JSON.parse(file);
151
151
  }
152
- function $19b0115754d0e244$var$createClient(metafilepath, metafile) {
152
+ function $78bfd81322641e96$var$createClient(metafilepath, metafile) {
153
153
  let socketfilepath = metafilepath.slice(0, -5);
154
154
  let [reader, writer] = (0, $ke4eu$vscodejsonrpcnode.createServerPipeTransport)(socketfilepath);
155
155
  let client = (0, $ke4eu$vscodejsonrpcnode.createMessageConnection)(reader, writer);
@@ -164,68 +164,68 @@ function $19b0115754d0e244$var$createClient(metafilepath, metafile) {
164
164
  client.onNotification((0, $ke4eu$parcellspprotocol.NotificationBuildStatus), (state, message)=>{
165
165
  // console.log('got NotificationBuildStatus', state, message);
166
166
  if (state === "start") {
167
- $19b0115754d0e244$var$progressReporter.begin();
168
- for (let uri of uris)$19b0115754d0e244$var$connection.sendDiagnostics({
167
+ $78bfd81322641e96$var$progressReporter.begin();
168
+ for (let uri of uris)$78bfd81322641e96$var$connection.sendDiagnostics({
169
169
  uri: uri,
170
170
  diagnostics: []
171
171
  });
172
- } else if (state === "progress" && message != null) $19b0115754d0e244$var$progressReporter.report(message);
172
+ } else if (state === "progress" && message != null) $78bfd81322641e96$var$progressReporter.report(message);
173
173
  else if (state === "end") {
174
174
  result.lastBuild = String(Date.now());
175
- $19b0115754d0e244$var$sendDiagnosticsRefresh();
176
- $19b0115754d0e244$var$progressReporter.done();
177
- $19b0115754d0e244$var$connection.sendNotification((0, $ke4eu$parcellspprotocol.NotificationBuild));
175
+ $78bfd81322641e96$var$sendDiagnosticsRefresh();
176
+ $78bfd81322641e96$var$progressReporter.done();
177
+ $78bfd81322641e96$var$connection.sendNotification((0, $ke4eu$parcellspprotocol.NotificationBuild));
178
178
  }
179
179
  });
180
180
  client.onNotification((0, $ke4eu$parcellspprotocol.NotificationWorkspaceDiagnostics), (diagnostics)=>{
181
181
  // console.log('got NotificationWorkspaceDiagnostics', diagnostics);
182
182
  for (let d of diagnostics){
183
183
  uris.add(d.uri);
184
- $19b0115754d0e244$var$connection.sendDiagnostics(d);
184
+ $78bfd81322641e96$var$connection.sendDiagnostics(d);
185
185
  }
186
186
  });
187
187
  client.onClose(()=>{
188
- $19b0115754d0e244$var$clients.delete(JSON.stringify(metafile));
189
- $19b0115754d0e244$var$sendDiagnosticsRefresh();
188
+ $78bfd81322641e96$var$clients.delete(JSON.stringify(metafile));
189
+ $78bfd81322641e96$var$sendDiagnosticsRefresh();
190
190
  return Promise.all([
191
191
  ...uris
192
- ].map((uri)=>$19b0115754d0e244$var$connection.sendDiagnostics({
192
+ ].map((uri)=>$78bfd81322641e96$var$connection.sendDiagnostics({
193
193
  uri: uri,
194
194
  diagnostics: []
195
195
  })));
196
196
  });
197
- $19b0115754d0e244$var$sendDiagnosticsRefresh();
198
- $19b0115754d0e244$var$clients.set(JSON.stringify(metafile), result);
197
+ $78bfd81322641e96$var$sendDiagnosticsRefresh();
198
+ $78bfd81322641e96$var$clients.set(JSON.stringify(metafile), result);
199
199
  }
200
200
  // Take realpath because to have consistent cache keys on macOS (/var -> /private/var)
201
- const $19b0115754d0e244$var$BASEDIR = $ke4eu$path.join($ke4eu$fs.realpathSync($ke4eu$os.tmpdir()), "parcel-lsp");
202
- $ke4eu$fs.mkdirSync($19b0115754d0e244$var$BASEDIR, {
201
+ const $78bfd81322641e96$var$BASEDIR = $ke4eu$path.join($ke4eu$fs.realpathSync($ke4eu$os.tmpdir()), "parcel-lsp");
202
+ $ke4eu$fs.mkdirSync($78bfd81322641e96$var$BASEDIR, {
203
203
  recursive: true
204
204
  });
205
- $ke4eu$fs.writeFileSync($ke4eu$path.join($19b0115754d0e244$var$BASEDIR, $19b0115754d0e244$var$LSP_SENTINEL_FILENAME), "");
205
+ $ke4eu$fs.writeFileSync($ke4eu$path.join($78bfd81322641e96$var$BASEDIR, $78bfd81322641e96$var$LSP_SENTINEL_FILENAME), "");
206
206
  // Search for currently running Parcel processes in the parcel-lsp dir.
207
207
  // Create an IPC client connection for each running process.
208
- for (let filename of $ke4eu$fs.readdirSync($19b0115754d0e244$var$BASEDIR)){
208
+ for (let filename of $ke4eu$fs.readdirSync($78bfd81322641e96$var$BASEDIR)){
209
209
  if (!filename.endsWith(".json")) continue;
210
- let filepath = $ke4eu$path.join($19b0115754d0e244$var$BASEDIR, filename);
211
- const contents = $19b0115754d0e244$var$loadMetafile(filepath);
210
+ let filepath = $ke4eu$path.join($78bfd81322641e96$var$BASEDIR, filename);
211
+ const contents = $78bfd81322641e96$var$loadMetafile(filepath);
212
212
  const { projectRoot: projectRoot } = contents;
213
- if ($19b0115754d0e244$var$WORKSPACE_ROOT === projectRoot) $19b0115754d0e244$var$createClient(filepath, contents);
213
+ if ($78bfd81322641e96$var$WORKSPACE_ROOT === projectRoot) $78bfd81322641e96$var$createClient(filepath, contents);
214
214
  }
215
215
  // Watch for new Parcel processes in the parcel-lsp dir, and disconnect the
216
216
  // client for each corresponding connection when a Parcel process ends
217
- $ke4eu$parcelwatcher.subscribe($19b0115754d0e244$var$BASEDIR, async (err, events)=>{
217
+ $ke4eu$parcelwatcher.subscribe($78bfd81322641e96$var$BASEDIR, async (err, events)=>{
218
218
  if (err) throw err;
219
219
  for (let event of events){
220
220
  if (event.type === "create" && event.path.endsWith(".json")) {
221
- const contents = $19b0115754d0e244$var$loadMetafile(event.path);
221
+ const contents = $78bfd81322641e96$var$loadMetafile(event.path);
222
222
  const { projectRoot: projectRoot } = contents;
223
- if ($19b0115754d0e244$var$WORKSPACE_ROOT === projectRoot) $19b0115754d0e244$var$createClient(event.path, contents);
223
+ if ($78bfd81322641e96$var$WORKSPACE_ROOT === projectRoot) $78bfd81322641e96$var$createClient(event.path, contents);
224
224
  } else if (event.type === "delete" && event.path.endsWith(".json")) {
225
- let existing = $19b0115754d0e244$var$clients.get(event.path);
225
+ let existing = $78bfd81322641e96$var$clients.get(event.path);
226
226
  console.log("existing", event.path, existing);
227
227
  if (existing) {
228
- $19b0115754d0e244$var$clients.delete(event.path);
228
+ $78bfd81322641e96$var$clients.delete(event.path);
229
229
  existing.connection.end();
230
230
  }
231
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/lsp",
3
- "version": "2.12.1-dev.3262+8b1749694",
3
+ "version": "2.12.1-dev.3264+5b2eaaf7b",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,10 +22,10 @@
22
22
  },
23
23
  "engines": {
24
24
  "node": ">= 12.0.0",
25
- "parcel": "^2.0.0-dev.1423+8b1749694"
25
+ "parcel": "^2.0.0-dev.1425+5b2eaaf7b"
26
26
  },
27
27
  "dependencies": {
28
- "@parcel/lsp-protocol": "2.12.1-dev.3262+8b1749694",
28
+ "@parcel/lsp-protocol": "2.12.1-dev.3264+5b2eaaf7b",
29
29
  "@parcel/watcher": "^2.0.7",
30
30
  "common-path-prefix": "^3.0.0",
31
31
  "nullthrows": "^1.1.1",
@@ -44,5 +44,5 @@
44
44
  "targets": {
45
45
  "types": false
46
46
  },
47
- "gitHead": "8b1749694c0ef79cefdacad40bb90c869a93993a"
47
+ "gitHead": "5b2eaaf7bcb1a4eceffcb265a7841caf441167cf"
48
48
  }