đRainbow CSV - VS Code extension: Highlight CSV and TSV files in different rainbow colors to make them more readable
Surprising VSCode filetype (language mode in the bottom-right corner) persistence behaviour:
~#~
, then switching to âplain textâ through the lang selection menu, than back to âdynamic csvâ.âDynamic CSVâ highlighting might not work because of the conflict with some other extensions.
To ensure the required behaviour we will use âdefensive programmingâ paradigm and there might be some redundancy in the method invocation (e.g. we might disable/enable something twice both on doc opening and closing), this is fine as long as the invocations are idempotent.
npm run lint
npm install
- OK to run in WSL.npm run compile-web && npm run start-web-server
- OK to run in WSL. - This should start a local server at http://localhost:3000/--browser=none
option and this option doesnât run unit tests automatically which could be an issue if you want to run tests instead of manual debugging.NOTE: if npm run test-in-browser
fails with an error it could show a message telling to install/update playwright - do it (it will also print the command, something like: npx playwright install
).
If it still doesnât work for some reason e.g. shows a blank page try to update the dependencies (this should update the package.json file content):
npx npm-check-updates -u
npm install
npm install
(If you have WSL - run in Windows, donât run in WSL).npm run test
in Windows (If you have WSL - run in Windows, donât run in WSL). Make sure that the tests are successful.npm install
(If you have WSL - run in Windows, donât run in WSL).npm run compile-web
(If you have WSL - run in Windows, donât run in WSL). This will combine all scripts into a single web script and put it into the dist
folder.npm run test-in-browser
(If you have WSL - run in Windows, donât run in WSL). This will open a new browser windows and run all the unit tests. Make sure that the tests are successful.NOTE: if npm run test-in-browser
fails with an error it could show a message telling to install/update playwright - do it (it will also print the command, something like: npx playwright install
).
If it still doesnât work for some reason e.g. shows a blank page try to update the dependencies (this should update the package.json file content):
npx npm-check-updates -u
npm install
npm install
- OK to run the command in WSL while launching in Windows. This will install the dependencies, including vscode/lib/testrunner
is_lazy_loaded
check to fail. An only known workaround is to quickly close all tabs in the test run and then restart the tests.Example of minimalistic test setup:
https://github.com/microsoft/vscode-extension-samples/tree/main/helloworld-test-sample
Looks like it is possible to directly run scripts from package.json with npx
like this:
npx vscode-test-web --help
And apparently another option to execute this command is (never tested):
npx @vscode/test-web --extensionDevelopmentPath=$extensionFolderPath $testDataPath
Options available for vscode-test-web
version
'insiders' | 'stable' | 'sources' [Optional, default 'insiders']
browser
'chromium' | 'firefox' | 'webkit' | 'none': The browser to launch. [Optional, defaults to 'chromium']
If none
is provided it wouldnât run unit test and it wouldnât kill the server when the browser window is closed.
If exceptions happens in extension.js you will be able to see it in the browser console (but the line number would be wrong).
The npx command npx serve --cors -l 5000
failed in WSL with cb.apply is not a function
error.
The same command worked as expected from Windows cmd.
Steps:
npx serve --cors -l 5000
- this may not work in WSL, in this case run in windows cmd. This local server uses http
instead of https
and because of that VSCode will not work with it directly, although the docs say otherwise (https://code.visualstudio.com/api/extension-guides/web-extensions#test-your-web-extension-in-on-vscode.dev) - it will just produce some cors/wss content security policy related errors in the log. So you need to do step 2.npx localtunnel -p 5000
- this will create a âtunnelâ server pointing to the server from the first command - this will produce a link like https://rotten-snake-42.loca.lt/
https://rotten-snake-42.loca.lt/
link and press the button - this will show the content of your extension folder - https server is working.https://rotten-snake-42.loca.lt/
link. In my experience this will work only with https urls. If you use http, the extension will be sort of âinstalledâ - it will be listed in the installed extension pannel but the main extension.js wonât be loaded so all the logic will be missing from it.npm install
(Better to avoid running this in WSL).node_modules/
and package-lock.json
file this is not a problem because they are excluded from final package via the .vscodeignore
file.vsce publish minor -p <key>
as usual. vsce will also automatically run vscode:prepublish
/ npm run package-web
command.npm install
(Better to avoid running this in WSL).node_modules/
and package-lock.json
file this is not a problem because they are excluded from final package via the .vscodeignore
file.npx ovsx publish -p <openvsx_token>
Unlike vsce publishing for the official Microsoft VSCode marketplace, ovsx tool does not need to be provided with version increment specification (such as major/minor/fix), instead it will just use the version from package.json file which is very convenient. And it will also wonât try to update that version value in package.json during the publishing process.
See more docs here: https://github.com/eclipse/openvsx/wiki/Publishing-Extensions
code tunnel
, see more here: https://code.visualstudio.com/docs/remote/tunnels#_using-the-code-cliRemote - Tunnels
extension https://code.visualstudio.com/blogs/2022/12/07/remote-even-betterRemote - Tunnels: Connect to Tunnel
command in the pallete.In order to generate RBQL documentation use showdown - based markdown_to_html.js script from junk/rainbow_stuff
Usage: node markdown_to_html.js ~/vscode_rainbow_csv/rbql_core/README.md out.html
Improve RBQL encoding handling logic when VScode encoding info API is implemented, see https://github.com/microsoft/vscode/issues/824.
Consider keeping only one open RBQL console at any time - if another one opens automatically close the previous one.
DEBUG: Add a huge no-op loop on startup in order to reproduce/emulate high-cpu load error from #55.
Support virtual header for rbql_csv.
Consider replacing the RBQL query text input with scrollable textarea - it has a drawback that on enter it will go to the next line instead running the query.
Store VSCode documents instead of file paths in result_set_parent_map so that the map can be used in web version. And the autodetection_stoplist also should be doc based to work in web.
Support JOIN queries in web version.
Support all commands in web version
Get rid of then
entirely
Merge rbql_query_web and rbql_query_node
Add feature to decorate separators with a transparent box or different color or something, see the opened issue.
Consider using RFC-like syntax by ajhyndman, see https://github.com/mechatroner/vscode_rainbow_csv/issues/4
Consider removing double quote autoclosing from non-csv/scsv dialects when native rfc csv is enabled.
Consider adding optional âkeep-it-darkâ mode that would force dark color theme even if all other filetypes use light color theme to improve csv readability.
Add "csv (tab)"
alias to TSV language if/when https://github.com/microsoft/vscode/issues/167208 is resolved
https://stackoverflow.com/questions/53625687/what-is-the-largest-filesize-supported-by-vs-code-syntax-highlighting
20MB Or 300K lines (avg 66 chars per line).