Skip to content

Commit 31e6063

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-1278
2 parents 7e83e48 + 203c016 commit 31e6063

File tree

6 files changed

+69
-43
lines changed

6 files changed

+69
-43
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [2.12.10] 13-Nov-2024
4+
- Fixes
5+
- Prevent overprompting for permission and account (#1456)
6+
37
## [2.12.9] 29-Oct-2024
48
- Enhancements
59
- Add `Launch Lite Terminal` action to Explorer (#1438)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ To unlock these features (optional):
5555

5656
1. Download and install a beta version from GitHub. This is necessary because Marketplace does not allow publication of extensions that use proposed APIs.
5757
- Go to https://github.com/intersystems-community/vscode-objectscript/releases
58-
- Locate the beta immediately above the release you installed from Marketplace. For instance, if you installed `2.12.9`, look for `2.12.10-beta.1`. This will be functionally identical to the Marketplace version apart from being able to use proposed APIs.
59-
- Download the VSIX file (for example `vscode-objectscript-2.12.10-beta.1.vsix`) and install it. One way to install a VSIX is to drag it from your download folder and drop it onto the list of extensions in the Extensions view of VS Code.
58+
- Locate the beta immediately above the release you installed from Marketplace. For instance, if you installed `2.12.10`, look for `2.12.11-beta.1`. This will be functionally identical to the Marketplace version apart from being able to use proposed APIs.
59+
- Download the VSIX file (for example `vscode-objectscript-2.12.11-beta.1.vsix`) and install it. One way to install a VSIX is to drag it from your download folder and drop it onto the list of extensions in the Extensions view of VS Code.
6060

6161
2. From [Command Palette](https://code.visualstudio.com/docs/getstarted/tips-and-tricks#_command-palette) choose `Preferences: Configure Runtime Arguments`.
6262
3. In the argv.json file that opens, add this line (required for both Stable and Insiders versions of VS Code):

package-lock.json

Lines changed: 39 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-objectscript",
33
"displayName": "InterSystems ObjectScript",
44
"description": "InterSystems ObjectScript language support for Visual Studio Code",
5-
"version": "2.12.10-SNAPSHOT",
5+
"version": "2.12.11-SNAPSHOT",
66
"icon": "images/logo.png",
77
"aiKey": "9cd75d51-697c-406c-a929-2bcf46e97c64",
88
"categories": [
@@ -48,7 +48,7 @@
4848
}
4949
],
5050
"engines": {
51-
"vscode": "^1.91.0"
51+
"vscode": "^1.93.0"
5252
},
5353
"enabledApiProposals": [
5454
"fileSearchProvider",
@@ -1777,16 +1777,17 @@
17771777
"test": "node ./out/test/runTest.js",
17781778
"lint": "eslint src/**",
17791779
"lint-fix": "eslint --fix src/**",
1780-
"download-api": "dts dev 1.91.0",
1780+
"download-api": "dts dev 1.93.0",
17811781
"postinstall": "npm run download-api"
17821782
},
17831783
"devDependencies": {
1784+
"@intersystems-community/intersystems-servermanager": "^3.8.0",
17841785
"@types/istextorbinary": "2.3.1",
17851786
"@types/minimatch": "5.1.2",
17861787
"@types/mocha": "^7.0.2",
17871788
"@types/node": "20.16.5",
17881789
"@types/semver": "7.5.4",
1789-
"@types/vscode": "1.91.0",
1790+
"@types/vscode": "1.93.0",
17901791
"@types/ws": "8.5.4",
17911792
"@types/xmldom": "^0.1.29",
17921793
"@typescript-eslint/eslint-plugin": "^7.12.0",

src/extension.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const smExtensionId = "intersystems-community.servermanager";
44

55
import vscode = require("vscode");
66
import * as semver from "semver";
7+
import * as serverManager from "@intersystems-community/intersystems-servermanager";
78

89
import { AtelierJob, Content, Response, ServerInfo } from "./api/atelier";
910
export const OBJECTSCRIPT_FILE_SCHEMA = "objectscript";
@@ -205,7 +206,7 @@ let reporter: TelemetryReporter = null;
205206

206207
export let checkingConnection = false;
207208

208-
let serverManagerApi: any;
209+
let serverManagerApi: serverManager.ServerManagerAPI;
209210

210211
// Map of the intersystems.server connection specs we have resolved via the API to that extension
211212
const resolvedConnSpecs = new Map<string, any>();
@@ -229,18 +230,26 @@ export async function resolveConnectionSpec(serverName: string): Promise<void> {
229230

230231
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
231232
export async function resolvePassword(serverSpec, ignoreUnauthenticated = false): Promise<void> {
232-
const AUTHENTICATION_PROVIDER = "intersystems-server-credentials";
233-
// This arises if setting says to use authentication provider
234233
if (
235234
// Connection isn't unauthenticated
236235
(!isUnauthenticated(serverSpec.username) || ignoreUnauthenticated) &&
237236
// A password is missing
238237
typeof serverSpec.password == "undefined"
239238
) {
240239
const scopes = [serverSpec.name, serverSpec.username || ""];
241-
let session = await vscode.authentication.getSession(AUTHENTICATION_PROVIDER, scopes, { silent: true });
240+
241+
// Handle Server Manager extension version < 3.8.0
242+
const account = serverManagerApi.getAccount ? serverManagerApi.getAccount(serverSpec) : undefined;
243+
244+
let session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, {
245+
silent: true,
246+
account,
247+
});
242248
if (!session) {
243-
session = await vscode.authentication.getSession(AUTHENTICATION_PROVIDER, scopes, { createIfNone: true });
249+
session = await vscode.authentication.getSession(serverManager.AUTHENTICATION_PROVIDER, scopes, {
250+
createIfNone: true,
251+
account,
252+
});
244253
}
245254
if (session) {
246255
// If original spec lacked username use the one obtained by the authprovider
@@ -1199,7 +1208,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
11991208
}
12001209
const fileName = filePathNoWorkspaceArr.join(".");
12011210
// Generate the new content
1202-
const newContent = generateFileContent(uri, fileName, Buffer.from(await vscode.workspace.fs.readFile(uri)));
1211+
const newContent = generateFileContent(uri, fileName, await vscode.workspace.fs.readFile(uri));
12031212
// Write the new content to the file
12041213
return vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(newContent.content.join("\n")));
12051214
})

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export type Entry = File | Directory;
3333
export function generateFileContent(
3434
uri: vscode.Uri,
3535
fileName: string,
36-
sourceContent: Buffer
36+
sourceContent: Uint8Array
3737
): { content: string[]; enc: boolean } {
3838
const sourceLines = sourceContent.length ? new TextDecoder().decode(sourceContent).split("\n") : [];
3939
const fileExt = fileName.split(".").pop().toLowerCase();
@@ -107,7 +107,7 @@ export function generateFileContent(
107107
}
108108
}
109109
return {
110-
content: [sourceContent.toString("base64")],
110+
content: [Buffer.from(sourceContent).toString("base64")],
111111
enc: true,
112112
};
113113
}
@@ -397,7 +397,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
397397

398398
public writeFile(
399399
uri: vscode.Uri,
400-
content: Buffer,
400+
content: Uint8Array,
401401
options: {
402402
create: boolean;
403403
overwrite: boolean;
@@ -654,11 +654,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
654654
const newCsp = newParams.has("csp") && ["", "1"].includes(newParams.get("csp"));
655655
const newFileName = newCsp ? newUri.path : newUri.path.slice(1).replace(/\//g, ".");
656656
// Generate content for the new file
657-
const newContent = generateFileContent(
658-
newUri,
659-
newFileName,
660-
Buffer.from(await vscode.workspace.fs.readFile(oldUri))
661-
);
657+
const newContent = generateFileContent(newUri, newFileName, await vscode.workspace.fs.readFile(oldUri));
662658
if (newFileStat) {
663659
// We're overwriting an existing file so prompt the user to check it out
664660
await fireOtherStudioAction(OtherStudioAction.AttemptedEdit, newUri);

0 commit comments

Comments
 (0)