mirror of
https://github.com/zerobig/vscode-1c-metadata-viewer.git
synced 2024-11-24 08:42:18 +02:00
Открытие XML
This commit is contained in:
parent
35be6a0e08
commit
efe308f6a8
@ -73,6 +73,10 @@
|
||||
{
|
||||
"command": "metadataViewer.openValueManagerModule",
|
||||
"title": "%1c-metadata-viewer.openValueManagerModule.title%"
|
||||
},
|
||||
{
|
||||
"command": "metadataViewer.openXml",
|
||||
"title": "%1c-metadata-viewer.openXml.title%"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
@ -126,6 +130,11 @@
|
||||
"command": "metadataViewer.openValueManagerModule",
|
||||
"group": "bsl",
|
||||
"when": "viewItem =~ /valueManager/"
|
||||
},
|
||||
{
|
||||
"command": "metadataViewer.openXml",
|
||||
"group": "xml",
|
||||
"when": "viewItem"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -8,5 +8,6 @@
|
||||
"1c-metadata-viewer.openModule.title": "Open module",
|
||||
"1c-metadata-viewer.openCommandModule.title": "Open command module",
|
||||
"1c-metadata-viewer.openRecordSetModule.title": "Open record set module",
|
||||
"1c-metadata-viewer.openValueManagerModule.title": "Open value manager module"
|
||||
"1c-metadata-viewer.openValueManagerModule.title": "Open value manager module",
|
||||
"1c-metadata-viewer.openXml.title": "Open XML"
|
||||
}
|
@ -8,5 +8,6 @@
|
||||
"1c-metadata-viewer.openModule.title": "Открыть модуль",
|
||||
"1c-metadata-viewer.openCommandModule.title": "Открыть модуль команды",
|
||||
"1c-metadata-viewer.openRecordSetModule.title": "Открыть модуль набора записей",
|
||||
"1c-metadata-viewer.openValueManagerModule.title": "Открыть модуль менеджера значения"
|
||||
"1c-metadata-viewer.openValueManagerModule.title": "Открыть модуль менеджера значения",
|
||||
"1c-metadata-viewer.openXml.title": "Открыть XML"
|
||||
}
|
@ -49,6 +49,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
const filePath = rootPath + '/Constants/' + node.label + '/Ext/ValueManagerModule.bsl';
|
||||
OpenFile(filePath);
|
||||
});
|
||||
vscode.commands.registerCommand('metadataViewer.openXml', (node: TreeItem) => {
|
||||
const filePath = rootPath + '/' + node.path + '.xml';
|
||||
OpenFile(filePath);
|
||||
});
|
||||
|
||||
new MetadataView(context);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ interface TreeItemParams {
|
||||
context?: string,
|
||||
command?: string,
|
||||
commandTitle?: string,
|
||||
path?: string,
|
||||
children?: TreeItem[],
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ export class MetadataView {
|
||||
}
|
||||
|
||||
const tree: TreeItem[] = [
|
||||
GetTreeItem({ $: { id: 'configuration', name: 'Конфигурация' } }, { context: 'main', children: [
|
||||
GetTreeItem({ $: { id: 'configuration', name: 'Конфигурация' } }, { path: 'Configuration', context: 'main', children: [
|
||||
GetTreeItem({ $: { id: 'common', name: 'Общие' } }, { icon: 'common', children: [
|
||||
GetTreeItem({ $: { id: 'subsystems', name: 'Подсистемы' } }, { icon: 'subsystem', children: [] }),
|
||||
GetTreeItem({ $: { id: 'commonModules', name: 'Общие модули' } }, { icon: 'commonModule', children: [] }),
|
||||
@ -122,7 +123,8 @@ function CreateTreeElements(metadataFile: MetadataFile) {
|
||||
if (!previous.form[objectName]) {
|
||||
previous.form[objectName] = [];
|
||||
}
|
||||
previous.form[objectName].push(GetTreeItem(current, { icon: 'form', context: 'form' }));
|
||||
previous.form[objectName].push(GetTreeItem(current, {
|
||||
icon: 'form', path: `${CreatePath(objectName)}/Forms/${current.$.name.split('.').pop()}`, context: 'form' }));
|
||||
} else if (current.$.name.includes('.Template.') && !current.$.name.endsWith('.Template')) {
|
||||
if (!previous.template[objectName]) {
|
||||
previous.template[objectName] = [];
|
||||
@ -314,7 +316,7 @@ function GetTreeItem(element: ObjectMetadata, params?: TreeItemParams ): TreeIte
|
||||
if (params?.context) {
|
||||
treeItem.contextValue = params.context;
|
||||
}
|
||||
treeItem.path = CreatePath(element.$.name.split('.').slice(0,2).join('.'));
|
||||
treeItem.path = params?.path ?? CreatePath(element.$.name.split('.').slice(0,2).join('.'));
|
||||
if (params?.command && params.commandTitle) {
|
||||
treeItem.command = { command: params.command, title: params.commandTitle };
|
||||
}
|
||||
@ -337,6 +339,7 @@ function SearchTree(element: TreeItem, matchingId: string): TreeItem | null {
|
||||
|
||||
function CreatePath(name: string): string {
|
||||
return name
|
||||
.replace('CommonModule.', 'CommonModules/')
|
||||
.replace('ExchangePlan.', 'ExchangePlans/')
|
||||
.replace('Constant.', 'Constants/')
|
||||
.replace('Catalog.', 'Catalogs/')
|
||||
|
Loading…
Reference in New Issue
Block a user