DeltaXML / vscode-xslt-tokenizer

VSCode extension for highlighting XSLT and XPath (upto 3.0/3.1)
MIT License
46 stars 4 forks source link

Allow source file selection in task drop-down #110

Closed neils-s closed 1 year ago

neils-s commented 1 year ago

My understanding is that currently the source XML and XSLT files that are fed to Saxon are specified in the tasks.json file in the .vscode subfolder of the project. I'm prone to typos, so manually specifying the file is a challenge.

I've used the Tasks Shell Input extension (https://github.com/augustocdias/vscode-shell-command) to augment my tasks.json file so I can select the relevant files from a dropdown list in the command palette: { "version": "2.0.0", "tasks": [ { "type": "xslt", "label": "xslt: Saxon Transform (New)", "saxonJar": "${config:XSLT.tasks.saxonJar}", "xsltFile": "${input:xsltFile}", "xmlSource": "${input:xmlFile}", "resultPath": "${workspaceFolder}/xslt-out/result1.xml", "allowSyntaxExtensions40": "off", "group": { "kind": "build" }, "problemMatcher": [ "$saxon-xslt" ] } ], "inputs":[ { "id":"xmlFile", "type":"command", "command":"shellCommand.execute", "args":{ "command":"dir /b \"${workspaceFolder}\\*.xml\"" } }, { "id":"xsltFile", "type":"command", "command":"shellCommand.execute", "args":{ "command":"dir /b \"${workspaceFolder}\\*.xsl?\"" } } ] }

This is a windows-specific hack. It uses the dir command, it relies on another extension, and it doesn't have any drill-down to get to XML and XSLT files in workspace subfolders. Even still, it's a labor-saver for me.

It would be cool if you could augment your extension with easy file selection capabilities.

pgfearo commented 1 year ago

Your understanding is correct and thanks for this feature request. I have been pondering simplifying file-path entry into the tasks.json file for some time.

I will investigate options for file selection. My first instinct is (if possible) to add two menu items to the VSCode File Explorer. This is inspired by the existing Select for Compare and Compare with Selected context menu options on the File Explorer. The two commands might be something like:

  1. Select Src XSLT task
  2. New XSLT task with Selected (using the current file as the XML source)

Hopefully commands can be set for the File Explorer in this way, if not there will probably need to be a standalone command that invokes a pick-list for selection of the XML input and the XSLT source files.

pgfearo commented 1 year ago

XSLT task properties can now reference new commands that allow file-selection via a file-explorer or a 'recently used' file list. These commands are documented in: Running XSLT

In the screenshot below you are prompted to either select a recently used file or select 'Pick File' that will show a File Explorer:

xslt-tasks-file