@valbuild/language-server 0.114.0 → 0.115.0

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.
@@ -1524,20 +1524,22 @@ function createValCommands(deps) {
1524
1524
  connection
1525
1525
  } = deps;
1526
1526
  try {
1527
- const session = await server.startValLogin();
1527
+ const authorization = await server.startValLogin();
1528
1528
  // `showDocument` with `external` is the standard way to reach a browser;
1529
1529
  // there is no Val-specific request for it, which is what lets any LSP
1530
1530
  // client drive this flow.
1531
1531
  await connection.sendRequest(vscodeLanguageserver.ShowDocumentRequest.type, {
1532
- uri: session.url,
1532
+ uri: authorization.verificationUriComplete,
1533
1533
  external: true
1534
1534
  });
1535
- // The poll runs for up to five minutes. Without progress the editor looks
1535
+ // The poll runs until the code expires. Without progress the editor looks
1536
1536
  // hung, and there is nothing to tell the user the browser is the next step.
1537
- const progress = await withProgress(connection, "Val: waiting for login", "Complete the login in your browser.");
1537
+ // The user code goes in the message so it can be compared against what the
1538
+ // browser shows — that comparison is what makes approving safe.
1539
+ const progress = await withProgress(connection, "Val: waiting for login", `Approve the login in your browser. Code: ${authorization.userCode}`);
1538
1540
  let confirmed;
1539
1541
  try {
1540
- confirmed = await server.awaitValLoginConfirmation(session.nonce, {
1542
+ confirmed = await server.awaitValLoginConfirmation(authorization, {
1541
1543
  signal: progress.signal
1542
1544
  });
1543
1545
  } finally {
@@ -1524,20 +1524,22 @@ function createValCommands(deps) {
1524
1524
  connection
1525
1525
  } = deps;
1526
1526
  try {
1527
- const session = await server.startValLogin();
1527
+ const authorization = await server.startValLogin();
1528
1528
  // `showDocument` with `external` is the standard way to reach a browser;
1529
1529
  // there is no Val-specific request for it, which is what lets any LSP
1530
1530
  // client drive this flow.
1531
1531
  await connection.sendRequest(vscodeLanguageserver.ShowDocumentRequest.type, {
1532
- uri: session.url,
1532
+ uri: authorization.verificationUriComplete,
1533
1533
  external: true
1534
1534
  });
1535
- // The poll runs for up to five minutes. Without progress the editor looks
1535
+ // The poll runs until the code expires. Without progress the editor looks
1536
1536
  // hung, and there is nothing to tell the user the browser is the next step.
1537
- const progress = await withProgress(connection, "Val: waiting for login", "Complete the login in your browser.");
1537
+ // The user code goes in the message so it can be compared against what the
1538
+ // browser shows — that comparison is what makes approving safe.
1539
+ const progress = await withProgress(connection, "Val: waiting for login", `Approve the login in your browser. Code: ${authorization.userCode}`);
1538
1540
  let confirmed;
1539
1541
  try {
1540
- confirmed = await server.awaitValLoginConfirmation(session.nonce, {
1542
+ confirmed = await server.awaitValLoginConfirmation(authorization, {
1541
1543
  signal: progress.signal
1542
1544
  });
1543
1545
  } finally {
@@ -1513,20 +1513,22 @@ function createValCommands(deps) {
1513
1513
  connection
1514
1514
  } = deps;
1515
1515
  try {
1516
- const session = await startValLogin();
1516
+ const authorization = await startValLogin();
1517
1517
  // `showDocument` with `external` is the standard way to reach a browser;
1518
1518
  // there is no Val-specific request for it, which is what lets any LSP
1519
1519
  // client drive this flow.
1520
1520
  await connection.sendRequest(ShowDocumentRequest.type, {
1521
- uri: session.url,
1521
+ uri: authorization.verificationUriComplete,
1522
1522
  external: true
1523
1523
  });
1524
- // The poll runs for up to five minutes. Without progress the editor looks
1524
+ // The poll runs until the code expires. Without progress the editor looks
1525
1525
  // hung, and there is nothing to tell the user the browser is the next step.
1526
- const progress = await withProgress(connection, "Val: waiting for login", "Complete the login in your browser.");
1526
+ // The user code goes in the message so it can be compared against what the
1527
+ // browser shows — that comparison is what makes approving safe.
1528
+ const progress = await withProgress(connection, "Val: waiting for login", `Approve the login in your browser. Code: ${authorization.userCode}`);
1527
1529
  let confirmed;
1528
1530
  try {
1529
- confirmed = await awaitValLoginConfirmation(session.nonce, {
1531
+ confirmed = await awaitValLoginConfirmation(authorization, {
1530
1532
  signal: progress.signal
1531
1533
  });
1532
1534
  } finally {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "lsp",
12
12
  "language-server"
13
13
  ],
14
- "version": "0.114.0",
14
+ "version": "0.115.0",
15
15
  "bin": {
16
16
  "val-language-server": "./bin.js"
17
17
  },
@@ -30,7 +30,7 @@
30
30
  "vscode-languageserver": "^10.1.0",
31
31
  "vscode-languageserver-textdocument": "^1.0.14",
32
32
  "@valbuild/core": "0.111.0",
33
- "@valbuild/server": "0.114.0",
33
+ "@valbuild/server": "0.115.0",
34
34
  "@valbuild/shared": "0.114.0"
35
35
  },
36
36
  "devDependencies": {