## 1.110.0

This commit is contained in:
2024-12-31 17:03:01 -07:00
parent 44d1dd172a
commit e64c2a988c
5 changed files with 66 additions and 119 deletions

View File

@ -43,6 +43,7 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
vscode.commands.registerCommand("kanban.refreshSidebar", refreshSidebar),
vscode.commands.registerCommand("kanban.refreshWebView", () => { refreshWebView(extensionContext); }),
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime),

View File

@ -9,6 +9,57 @@ export function refreshBoth(extensionContext: vscode.ExtensionContext): any {
setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
}
async function openInNewWindowLogic(): Promise<any> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return;
}
if (vscode.window.tabGroups.activeTabGroup.activeTab === undefined) {
vscode.window.showInformationMessage("Open a tab first!");
return;
}
const activeTabLabel = vscode.window.tabGroups.activeTabGroup.activeTab.label;
const paramCaseActiveTabLabel: string = paramCase(activeTabLabel);
vscode.window.showInformationMessage(`Searching for <${paramCaseActiveTabLabel}>`);
const fileUris: vscode.Uri[] = await vscode.workspace.findFiles(`**/${paramCaseActiveTabLabel}*`);
if (fileUris.length === 0) {
vscode.window.showInformationMessage(`Didn't find a file matching <${paramCaseActiveTabLabel}>!`);
return;
}
for (let i = 0; i < fileUris.length; ++i) {
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(fileUris[i]);
for (let j = 0; j < textDocument.lineCount; ++j) {
const text = textDocument.lineAt(j).text;
if (text.endsWith('"')) {
if (text.startsWith("code \"")) {
const lastText = textDocument.lineAt(j - 1).text;
if (lastText.startsWith("```")) {
const uri = vscode.Uri.parse("file:" + text.substring(6, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
}
if (text.startsWith("codium \"")) {
const lastText = textDocument.lineAt(j - 1).text;
if (lastText.startsWith("```")) {
const uri = vscode.Uri.parse("file:" + text.substring(8, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
}
if (text.startsWith("code-insiders \"")) {
const lastText = textDocument.lineAt(j - 1).text;
if (lastText.startsWith("```")) {
const uri = vscode.Uri.parse("file:" + text.substring(15, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
}
}
}
}
}
async function openWithTextEditorLogic(): Promise<any> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
@ -32,4 +83,5 @@ async function openWithTextEditorLogic(): Promise<any> {
}
}
export const openInNewWindow = () => openInNewWindowLogic();
export const openWithTextEditor = () => openWithTextEditorLogic();