Files

17 lines
8.3 KiB
JavaScript
Raw Permalink Normal View History

2025-10-25 20:35:10 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";var u=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var E=(a,o,e)=>o in a?u(a,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[o]=e;var O=(a,o)=>{for(var e in o)u(a,e,{get:o[e],enumerable:!0})},A=(a,o,e,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of D(o))!F.call(a,i)&&i!==e&&u(a,i,{get:()=>o[i],enumerable:!(s=k(o,i))||s.enumerable});return a};var U=a=>A(u({},"__esModule",{value:!0}),a);var r=(a,o,e)=>E(a,typeof o!="symbol"?o+"":o,e);var y={};O(y,{default:()=>b});module.exports=U(y);var d=require("obsidian");var l=require("obsidian");var n={ribbonIcon:!0,ribbonCommandUsesCode:!0,showFileContextMenuItem:!0,executeTemplate:'code "{{vaultpath}}" "{{vaultpath}}/{{filepath}}"',urlProtocol:"vscode",openFile:!0,workspacePath:"{{vaultpath}}"},m=class extends l.PluginSettingTab{constructor(e,s){super(e,s);r(this,"plugin");this.plugin=s}display(){let{containerEl:e}=this;e.empty(),e.createEl("h3",{text:"General settings"}),new l.Setting(e).setName("Display Ribbon Icon").setDesc("Toggle this OFF if you want to hide the Ribbon Icon.").addToggle(i=>i.setValue(this.plugin.settings.ribbonIcon).onChange(t=>{this.plugin.settings.ribbonIcon=t,this.plugin.saveSettings(),this.plugin.refreshIconRibbon()})),new l.Setting(e).setName("Ribbon opens via 'code' command").setDesc("Toggle this OFF if you'd prefer that the Ribbon Icon opens VSCode via URL.").addToggle(i=>i.setValue(this.plugin.settings.ribbonCommandUsesCode).onChange(t=>{this.plugin.settings.ribbonCommandUsesCode=t,this.plugin.saveSettings()})),new l.Setting(e).setName('Display "Open in VS Code" option for files/folders').setDesc('Toggle this OFF to hide the "Open in VS Code" option when right-clicking a file/folder.').addToggle(i=>i.setValue(this.plugin.settings.showFileContextMenuItem).onChange(t=>{this.plugin.settings.showFileContextMenuItem=t,this.plugin.saveSettings()})),e.createEl("h3",{text:"Open via 'code' CLI settings"}),new l.Setting(e).setName("Template for executing the 'code' command").setDesc(`You can use the following variables: '{{vaultpath}}' (absolute), '{{filepath}}' (relative), '{{folderpath}}' (relative), '{{line}}' and '{{ch}}'. Note that on MacOS, a full path to the VSCode executable is required (generally '/usr/local/bin/code'). Example template: "'/usr/local/bin/code' '{{vaultpath}}' '{{vaultpath}}/{{filepath}}'"`).addText(i=>i.setPlaceholder(n.executeTemplate).setValue(this.plugin.settings.executeTemplate||n.executeTemplate).onChange(t=>{t=t.trim(),t===""&&(t=n.executeTemplate),this.plugin.settings.executeTemplate=t,this.plugin.saveData(this.plugin.settings)})),e.createEl("h3",{text:"Open via 'vscode://' URL settings"}),e.createEl("p",{text:"See: "}).appendChild(createEl("a",{text:"Opening VS Code with URLs",href:"https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls"})),new l.Setting(e).setName("Open current file").setDesc("Open the current file rather than the root of the vault.").addToggle(i=>i.setValue(this.plugin.settings.openFile||n.openFile).onChange(t=>{this.plugin.settings.openFile=t,this.plugin.saveData(this.plugin.settings)})),new l.Setting(e).setName("Path to VSCode Workspace").setDesc('Defaults to the {{vaultpath}} template variable. You can set this to an absolute path to a ".code-workspace" file if you prefer to use a ').addText(i=>i.setPlaceholder(n.workspacePath).setValue(this.plugin.settings.workspacePath||n.workspacePath).onChange(t=>{t=t.trim(),t===""&&(t=n.workspacePath),this.plugin.settings.workspacePath=t,this.plugin.saveData(this.plugin.settings)})).descEl.appendChild(createEl("a",{text:"multi-root workspace",href:"https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces"})).appendText("."),new l.Setting(e).setName("URL protocol").setDesc("You can override the default vscode:// to VSCode Insiders, VSCodium or other VSCode variants' protocol string").addText(i=>i.setPlaceholder(n.urlProtocol).setValue(this.plugin.settings.urlProtocol||n.urlProtocol).onChange(t=>{t=t.tri
<svg role="img" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<title>Visual Studio Code</title>
<path
fill="currentColor"
d="M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z"
/>
</svg>
`);var b=p;
/* nosourcemap */