Skip to content

Commit 7b4314d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-233
2 parents 17776e0 + 801aeaf commit 7b4314d

File tree

8 files changed

+69
-35
lines changed

8 files changed

+69
-35
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- master
77
paths-ignore:
8+
- 'docs/**'
9+
- '.vscode/**'
10+
- '.github/**'
811
- '*.md'
912
- '**/*.md'
1013
pull_request:
@@ -21,7 +24,9 @@ jobs:
2124
matrix:
2225
os: [ubuntu-latest, windows-latest, macOS-latest]
2326
steps:
24-
- uses: actions/checkout@master
27+
- uses: actions/checkout@v2
28+
with:
29+
ref: master
2530
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
2631
- name: Set an output
2732
id: set-version
@@ -45,7 +50,7 @@ jobs:
4550
echo $VERSION > ./dist/.version
4651
echo $NAME > ./dist/.name
4752
- name: Use Node.js
48-
uses: actions/setup-node@master
53+
uses: actions/setup-node@v1
4954
with:
5055
node-version: 12.x
5156
- run: npm install
@@ -61,7 +66,7 @@ jobs:
6166
if: runner.os == 'Linux'
6267
run: |
6368
./node_modules/.bin/vsce package -o ./dist/package.vsix
64-
- uses: actions/upload-artifact@master
69+
- uses: actions/upload-artifact@v2
6570
if: runner.os == 'Linux'
6671
with:
6772
name: vsix
@@ -71,7 +76,7 @@ jobs:
7176
runs-on: ubuntu-latest
7277
needs: build
7378
steps:
74-
- uses: actions/download-artifact@master
79+
- uses: actions/download-artifact@v2
7580
with:
7681
name: vsix
7782
path: ./dist/
@@ -84,7 +89,7 @@ jobs:
8489
echo ::set-output name=name::`cat ./dist/.name`
8590
- name: Create Release
8691
id: create_release
87-
uses: actions/create-release@master
92+
uses: actions/create-release@v1
8893
if: runner.os == 'Linux'
8994
env:
9095
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -97,7 +102,7 @@ jobs:
97102
${{ steps.set-version.outputs.changelog }}
98103
- name: Upload Release Asset
99104
id: upload-release-asset
100-
uses: actions/upload-release-asset@master
105+
uses: actions/upload-release-asset@v1
101106
if: runner.os == 'Linux'
102107
env:
103108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -114,12 +119,13 @@ jobs:
114119
- uses: actions/checkout@v2
115120
with:
116121
ref: master
117-
- uses: actions/download-artifact@master
122+
token: ${{ secrets.TOKEN }}
123+
- uses: actions/download-artifact@v2
118124
with:
119125
name: vsix
120126
path: ./dist/
121127
- name: Use Node.js
122-
uses: actions/setup-node@master
128+
uses: actions/setup-node@v1
123129
with:
124130
node-version: 12.x
125131
- name: Prepare build
@@ -137,11 +143,10 @@ jobs:
137143
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
138144
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
139145
npm install
140-
npm i -g vsce ovsx
141146
git push
142147
- name: Upload Release Asset
143148
id: upload-release-asset
144-
uses: actions/upload-release-asset@master
149+
uses: actions/upload-release-asset@v1
145150
if: runner.os == 'Linux'
146151
env:
147152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -152,6 +157,6 @@ jobs:
152157
asset_content_type: application/zip
153158
- name: Publish to Marketplaces
154159
run: |
155-
vsce publish -p ${{ secrets.VSCE_TOKEN }}
156-
ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
160+
./node_modules/.bin/vsce publish -p ${{ secrets.VSCE_TOKEN }}
161+
./node_modules/.bin/ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
157162

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,19 @@ We recommend you define server connections in the `intersystems.servers` object
4343
"host": "127.0.0.1",
4444
"port": 52773
4545
},
46-
"description": "My local IRIS",
47-
"username": "me"
46+
"description": "My local IRIS",
47+
"username": "me"
4848
}
4949
}
5050
```
51-
Setting the `username` property is optional. If omitted it will be prompted for when connecting.
5251

53-
By defining connections in your User Settings they become available for use by any workspace you open in VSCode.
52+
By defining connections in your User Settings they become available for use by any workspace you open in VSCode. Alternatively, define them in workspace-specific settings.
53+
54+
Setting the `username` property is optional. If omitted it will be prompted for when connecting, then cached for the session..
55+
56+
Setting a plaintext value for the `password` property is not recommended. Instead, run the `InterSystems Server Manager: Store Password in Keychain` command from Command Palette.
57+
58+
If no password has been set or stored it will be prompted for when connecting, then cached for the session.
5459

5560
### Client-side Editing
5661

@@ -66,7 +71,9 @@ We recommend that `objectscript.conn` uses its `server` property to point to an
6671
}
6772
```
6873

69-
The mandatory `ns` property defines which server namespace you will work with. If `username` is set here it overrides that setting from the `intersystems.servers` entry.
74+
The mandatory `ns` property defines which server namespace you will work with.
75+
76+
When the `server` property is set, any `username` or `password` properties of `objectscript.conn` are ignored. Instead these values come from the `intersystems.servers` entry.
7077

7178
### Server-side Editing
7279

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@
893893
"minimist": ">=1.2.5",
894894
"mocha": "^8.0.1",
895895
"nock": "^13.0.0",
896+
"ovsx": "latest",
896897
"prettier": "^2.0.5",
897898
"tape": "^5.0.1",
898899
"ts-loader": "^7.0.5",

src/explorer/explorer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ export class ObjectScriptExplorerProvider implements vscode.TreeDataProvider<Nod
7777
const conn: any = config("conn", workspaceFolder.name);
7878
if (conn.active && conn.ns) {
7979
const extra4Workspace = this._showExtra4Workspace[workspaceFolder.name] || [];
80-
node = new WorkspaceNode(workspaceFolder.name, this._onDidChangeTreeData, {});
80+
node = new WorkspaceNode(workspaceFolder.name, this._onDidChangeTreeData, {
81+
workspaceFolder: workspaceFolder.name,
82+
});
8183
rootNodes.push(node);
8284

8385
extra4Workspace.forEach((ns) => {
8486
node = new WorkspaceNode(workspaceFolder.name, this._onDidChangeTreeData, {
87+
workspaceFolder: workspaceFolder.name,
8588
namespace: ns,
8689
extraNode: true,
8790
});

src/extension.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
388388
});
389389
toCheck.forEach(async function (uri, configName) {
390390
if (serverManagerApi && serverManagerApi.getServerSpec) {
391-
const connSpec = await serverManagerApi.getServerSpec(configName);
392-
if (connSpec) {
393-
resolvedConnSpecs.set(configName, connSpec);
391+
const serverName = uri.scheme === "file" ? config("conn", configName).server : configName;
392+
if (serverName && serverName !== "" && !resolvedConnSpecs.has(serverName)) {
393+
const connSpec = await serverManagerApi.getServerSpec(serverName);
394+
if (connSpec) {
395+
resolvedConnSpecs.set(serverName, connSpec);
396+
}
394397
}
395398
}
396399
checkConnection(true, uri);

src/providers/ObjectScriptCompletionItemProvider.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from "vscode";
22

33
import { AtelierAPI } from "../api/index";
44
import { ClassDefinition } from "../utils/classDefinition";
5-
import { currentFile, onlyUnique } from "../utils/index";
5+
import { currentFile, onlyUnique, notNull } from "../utils/index";
66
import commands = require("./completion/commands.json");
77
import structuredSystemVariables = require("./completion/structuredSystemVariables.json");
88
import systemFunctions = require("./completion/systemFunctions.json");
@@ -40,17 +40,19 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
4040
);
4141
}
4242
}
43-
const completions =
44-
this.classes(document, position, token, context) ||
45-
this.macrolist(document, position, token, context) ||
46-
this.dollarsComplete(document, position) ||
47-
this.commands(document, position) ||
48-
this.entities(document, position, token, context) ||
49-
this.macro(document, position, token, context) ||
50-
this.constants(document, position, token, context) ||
51-
null;
43+
const completions = []
44+
.concat(
45+
this.classes(document, position, token, context),
46+
this.macrolist(document, position, token, context),
47+
this.dollarsComplete(document, position),
48+
this.commands(document, position),
49+
this.entities(document, position, token, context),
50+
this.macro(document, position, token, context),
51+
this.constants(document, position, token, context)
52+
)
53+
.filter(notNull);
5254

53-
return completions;
55+
return Promise.all(completions).then((data) => data.flatMap((el) => el.items || el));
5456
}
5557

5658
public macro(

src/utils/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,21 @@ export function currentFile(document?: vscode.TextDocument): CurrentFile {
4343
if (!document) {
4444
return null;
4545
}
46+
const fileName = document.fileName;
47+
const fileExt = fileName.split(".").pop().toLowerCase();
4648
if (
4749
!schemas.includes(document.uri.scheme) &&
48-
(!document || !document.fileName || !document.languageId || !document.languageId.startsWith("objectscript"))
50+
(!document ||
51+
!document.fileName ||
52+
!document.languageId ||
53+
!document.languageId.startsWith("objectscript") ||
54+
fileExt.match(/(csp)/i)) // Skip CSP for now, yet
4955
) {
5056
return null;
5157
}
5258
const eol = document.eol || vscode.EndOfLine.LF;
5359
const uri = document.uri;
54-
const fileName = document.fileName;
5560
const content = document.getText();
56-
const fileExt = fileName.split(".").pop().toLowerCase();
5761
let name = "";
5862
let ext = "";
5963
const { query } = url.parse(decodeURIComponent(uri.toString()), true);

0 commit comments

Comments
 (0)