Skip to content

Commit

Permalink
Merge branch 'master' into view-update
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano authored Jan 4, 2024
2 parents c64a362 + 99eb41a commit 63353e5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,11 @@
"type": "boolean",
"default": false
},
"objectscript.autoAdjustName": {
"markdownDescription": "Automatically modify the class name or ROUTINE header to match the file's path when copying or creating a new file. Does not affect `isfs` files.",
"type": "boolean",
"default": true
},
"objectscript.compileOnSave": {
"description": "Automatically compile an InterSystems file when saved in the editor.",
"type": "boolean",
Expand Down
7 changes: 6 additions & 1 deletion src/commands/webSocketTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const keys = {
ctrlE: "\x05",
ctrlH: "\x08",
del: "\x1b[3~",
home: "\x1b\x5b\x48",
end: "\x1b\x5b\x46",
};

const actions = {
Expand Down Expand Up @@ -168,6 +170,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
outputChannel.appendLine(
typeof error == "string" ? error : error instanceof Error ? error.message : JSON.stringify(error)
);
outputChannel.appendLine("Check that the InterSystems server's web server supports WebSockets.");
outputChannel.show(true);
vscode.window.showErrorMessage(
"Failed to initialize WebSocket Terminal. Check 'ObjectScript' Output channel for details.",
Expand Down Expand Up @@ -372,7 +375,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
inputArr[inputArr.length - 1].slice(0, this._cursorCol - this._margin) +
inputArr[inputArr.length - 1].slice(this._cursorCol - this._margin + 1);
this._input = inputArr.join("\r\n");
this._hideCursorWrite(actions.cursorForward + actions.deleteChar + actions.cursorBack);
this._hideCursorWrite(actions.deleteChar);
if (this._input != "" && this._state == "prompt" && this._syntaxColoringEnabled()) {
// Syntax color input
this._socket.send(JSON.stringify({ type: "color", input: this._input }));
Expand Down Expand Up @@ -484,6 +487,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
this._state = "eval";
return;
}
case keys.home:
case keys.ctrlA: {
if (this._state == "prompt" && this._cursorCol - this._margin > 0) {
// Move the cursor to the beginning of the line
Expand All @@ -492,6 +496,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
}
return;
}
case keys.end:
case keys.ctrlE: {
if (this._state == "prompt") {
// Move the cursor to the end of the line
Expand Down
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
RESTDebugPanel.create(context.extensionUri)
),
vscode.commands.registerCommand("vscode-objectscript.exportCurrentFile", exportCurrentFile),
vscode.workspace.onDidCreateFiles((e: vscode.FileCreateEvent) =>
Promise.all(
vscode.workspace.onDidCreateFiles((e: vscode.FileCreateEvent) => {
if (!config("autoAdjustName")) return;
return Promise.all(
e.files
.filter((uri) => !filesystemSchemas.includes(uri.scheme))
.filter((uri) => ["cls", "inc", "int", "mac"].includes(uri.path.split(".").pop().toLowerCase()))
Expand Down Expand Up @@ -1078,8 +1079,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
// Write the new content to the file
return vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(newContent.content.join("\n")));
})
)
),
);
}),
vscode.window.onDidChangeActiveTextEditor((editor: vscode.TextEditor) => {
if (config("openClassContracted") && editor && editor.document.languageId === "objectscript-class") {
const uri: string = editor.document.uri.toString();
Expand Down
17 changes: 14 additions & 3 deletions src/providers/FileSystemProvider/TextSearchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function searchMatchToLine(
// This is in the class description
line = descLineToDocLine(content, match.attrline, i);
break;
} else if (match.attr == "Super") {
// This is a superclass
} else if (match.attr == "Super" || match.attr == "Name") {
// This is in the class definition line
if (content[i].includes(match.text)) {
line = i;
}
Expand Down Expand Up @@ -306,7 +306,18 @@ export class TextSearchProvider implements vscode.TextSearchProvider {

/** Report matches in `file` to the user */
const reportMatchesForFile = async (file: SearchResult): Promise<void> => {
if (token.isCancellationRequested) {
// The last three checks are needed to protect against
// bad output from the server due to a bug.
if (
// The user cancelled the search
token.isCancellationRequested ||
// The server reported no matches in this file
!file.matches.length ||
// The file name is malformed
(file.doc.includes("/") && !/^\/(?:[^/]+\/)+[^/.]*(?:\.[^/.]+)+$/.test(file.doc)) ||
(!file.doc.includes("/") &&
!/^(%?[\p{L}\d\u{100}-\u{ffff}]+(?:\.[\p{L}\d\u{100}-\u{ffff}]+)+)$/u.test(file.doc))
) {
return;
}

Expand Down

0 comments on commit 63353e5

Please sign in to comment.