evidence-dev / evidence-vscode Goto Github PK
View Code? Open in Web Editor NEWThe official VS Code extension for Evidence projects.
Home Page: https://marketplace.visualstudio.com/items?itemName=Evidence.evidence-vscode
License: MIT License
The official VS Code extension for Evidence projects.
Home Page: https://marketplace.visualstudio.com/items?itemName=Evidence.evidence-vscode
License: MIT License
and display running process id to help troubleshoot all executed terminal command sequences.
to view running Evidence app status, and start or stop app dev server via terminal commands from #4.
in addition to the Evidence: Open Settings File
from #5 to enable configuring data source(s) via Evidence app UI.
utils/jsonUtils.ts
to load package.json
from the open project workspacehasDependency()
to the new jsonUtils.ts
to check for any dev and regular node.js dependenciesjsonUtils
in extension activation method to enable Start Dev Server
command, etc.We researched this yesterday and shared preliminary info in slack:
looking at the built-in simple browser implementation I don't see a quick and easy way for us to open it on the side, or change that webview title and icon. So, if we want to see more stylized Evidence built-in browser and have more open/close/reload page options, we'd need to invest time into implementing our own. ... https://github.com/microsoft/vscode/blob/main/extensions/simple-browser/src/extension.ts
Also, that Simple Browser webview API doesn't provide close view option, and VS Code itself still doesn't have an API to iterate over all open webviews, only visibleTextEditors
list is available. Therefore, it is not possible for us to close Simple Browser, without implementing our own or using another extension like the popular, but not maintained Browser Lite
.
The only other quick workaround without investing 2-3 days on implementing your own custom Evidence App webview, is:
Start Dev Server
"greeting" page to your app ./static
folder and standard app template
Start Dev Server
"greeting" page in a Simple Browser, so that it doesn't show up blank.Loading ...
home page while the server starts and generates pages. I've requested this multiple times in slack and tickets here to address long blank app page view in a browser.That's a few hours, most likely a day of setup, dev, testing and coordination with the app dev team, if you'd like us to open a UX enhancement ticket to address it this or next week.
On the related note, we can also open new active editor group on the side, and maybe add Preview on the Side
for the Simple Browser to show up there. However, changing that built-in browser title and icon is not possible per my read of that built-in vscode extension API referenced above.
Originally posted by @RandomFractals in #24 (comment)
We should do this to prevent Evidence commands display in Command Palette, file explorer and editor context menus for the open project workspaces with .md
and package.json
files that are not Evidence web app projects.
with instructions how to build this VS Code extension project for Evidence dev team and others from the dev community to check out the latest version before new release.
We'll use this example: https://github.com/RandomFractals/vscode-data-table#dev-build
Evidence: Preview
command with evidence.preview
id.md
filenames using app routes to display Preview for the open .md
document/page. See file based routing doc for more info.emd
documents in a project.This is not really a discrete feature vs a place to discuss this in public.
Taking inspiration from the Malloy codespace which is excellent.
Some notes from @hughess
Was checking out Malloy’s extension again:
They have a really smooth getting started path - maybe we should replicate
- Theirs is click to “try Malloy in your browser now”
- That opens a github.dev link, which takes you to codespace
- Codespace is working right away, clicking to run a query brings up almost instant feedback
Would be great to get to an "everything just works" experience in Evidence template codespace. If we need to make changes to the template to support this, we can
Fine tuning -- not for current release
If you launch the dev server while localhost:3000 is occupied elsewhere, evidence will launch on localhost:3001 -- the simple browser preview that the extension opens should respect the new development url.
npm install
via terminal from #4 to install NodeJS modules for the Evidence project.Aware that this is a "next week" (rather than right now) task but wanted somewhere to write about this.
Feel free to break down into smaller issues and close this one if it makes sense.
select * from table
and return 100,000 rows to VSCode. Should we break, return error, paginateper comments in #32
package.json
Commands
section in 'README.md`docs/images
Just want to leave this as a flag for us in the future, no action required.
This is totally fine for now, but eventually it seems like we should be respecting whatever version semver users have in their project (e.g. they are only accepting minor bumps).
template
project after it is cloned in #2needful_things.duckdb
data source config issuesRelated ticket with more info on that configuration: evidence-dev/evidence#885 (comment)
We'll resolve this on our end by:
templateProjectSettings
json config to commands/template.ts
implementation.evidence/template/evidence.settings.json
file after a project is scaffolded from the github template
project repo.evidence/template/evidence.settings.json:
{
"database": "duckdb",
"credentials": {
"filename": "needful_things.duckdb",
"gitignoreDuckdb": null
}
}
Create Project from Template
info messages, prompts and progress display UI parts for a better project starter navigation/creation UX flowto delete cached content from .evidence/template/.evidence-queries
folder.
Evidence queries folder stores results from SQL queries that pull data from the configured data source(s) and are linked and displayed in the app pages/views. See Query Cache in Evidence dev docs for more info.
Evidence.dev has a published VSCode extension with emd
language grammar, configuration and code snippets.
We'll import existing Evidence extension code from the Evidence monorepo, and will use it as a starting point for the Evidence extension with Preview and other new interactive features.
Per our discussions and scope set for the phase 1 of interactive Evidence extension features, we'll add Evidence: New Project
functionality.
evidence.newProject
command config to package.json
New Evidence Project
context menu to folders in the File Explorer by adding evidence.newProject
command to menus: explorer:context []
commands and contribution point in extension package.json
configNewEvidence
enum value to Commands
to register enum in commands.ts
src/commands/project.ts
for the project command(s) implementation with Select Folder
dialog when no new project folder Uri is providedCommand Palette...
template
project to the selected empty workspace folderCommands
section to readme.md
with the commands md table and descriptions.Example: https://github.com/RandomFractals/tabular-data-viewer#commands
VSCode provides public API and configuration options available to all extensions to create interactive Walkthroughs and onboard new users via a guided tour of features.
We'll use walkthroughs to highlight the initial set of new interactive Evidence extension features.
Proposed content and walkthrough steps we can include in the first interactive Evidence ext. v1.0.0 release:
We'll use walkthroughs config documentation for this implementation.
Evidence
node -v
command when initializing terminalEvidence app CLI commands: https://docs.evidence.dev/cli/
CLI impl.: evidence/cli.js
to scaffold new Evidence app project.
degit.json
and .github
folder with smoke test workflows after template project cloningbuild-template.js
code in evidence core package.Note: there is a new open issue in the core Evidence repo to move template project into that monorepo (evidence-dev/evidence#883). Our recommendation would be to keep template project, current and future demo apps in separate repositories to make it easier for your end-users to clone, build, and use them.
to build the static version of Evidence app/reports as described in Evidence Build Commands documentation section.
Evidence: Build
commandEvidence: Build Strict
command for the strict mode/node_modules
folder and install dependencies via #13 prior to running build commandsper initial internal review of the v1.0.0
of this extension and finding that the current extensive list of commands is long and might be somewhat overwhelming to the Evidence app users using VS Code. See #34 fore more info.
Really cool overall, I could see myself using it for sure.
We can use the start server demo gif from #3 (comment) for now.
Looking good. I like it a lot!
Some final QA from me.
EDIT: see #31
If port 3000 is busy in another process, then vite uses 3001 (i was writing docs for evidence on another port).
However the VSCode extension always uses 3000.
Can we detect which port it opens and open the browser on that one?
We have quite a lot of commands which can add a level of mental load to the user when choosing the right one. I think we might be able to reduce the number slightly
There are a couple of commands that feel a bit duplicative to me, so we might want to consider dropping them:
to gauge the number of users updating Evidence VS Code extension in the upcoming releases.
shields.io
API and service for those badgesSample display of those VS Code extension badges from our Geo Data Viewer:
Evidence extension maps keybindings for the built-in markdown document Preview commands in package.json
. This hides access to the .md
Preview for the standard markdown documents.
https://github.com/evidence-dev/vscode/blob/main/package.json#L109
keybindings": [
{
"command": "markdown.showPreview",
"key": "shift+ctrl+v",
"mac": "shift+cmd+v",
"when": "!notebookEditorFocused && editorLangId == 'emd'"
},
{
"command": "markdown.showPreviewToSide",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "!notebookEditorFocused && editorLangId == 'emd'"
}
]
Current emd
language configuration also marks all .md
files as Evidence markdown documents.
We need to resolve this issue to avoid negative reviews in vscode marketplace. Evidence markdown should not hijack normal .md
handling in vscode.
Recommended solution used by all custom markdown language flavors in vscode is to use a custom filename extension (.emd
) for the Evidence app page files.
See related thread in vscode channel in Evidence dev slack.
to resolve general confusion about App Preview
and Start Server
commands, encountered during initial internal testing of v1.0.0. See initial review and test results feedback in #24 and #34 for more info.
menus/commandPalette
contribution point to package.json
and set evidence.preview
command to never
show thereI might have the wrong mental model about vs code extensions, but after playing with this, I wonder if this might be a reasonable way forward on a couple items.
I think we should have the extension detect whether or not there is an Evidence project in the current VS code workspace, and use that information to determine which status bar items, or command palette items are available.
If it's possible to use that same approach to decide how to treat .md files, I also think that would be a sensible way to go.
When an evidence project is detected in the workspace, we should offer all of the commands and status bar items, regardless of what files are open in vscode.
Eventually we might have some commands which are file specific, but right now all of them are project-level.
It seems like we're facing some weird trade-offs to have the extension whether or not we can safely override the built in markdown features
The options so far are:
If it's possible to use logic beyond just the file extension to determine how to treat the file, I think we could use the above approach to make a simpler judgements about how to treat the .md files that the extension encounters:
For example, the readme.md in the root of an evidence project should not be treated like evidence markdown.
to updated evidence libraries to the latest version.
npm install @evidence-dev/evidence@latest
, etc. terminal commands to implement this shortcut.package.json
to point to this repositoryevidence-vscode
and update repository references in package.json
evidence-vscode-v1.0.0
release and create release notes with .vsix
attachment (@RandomFractals)Blocked by evidence-dev/evidence#901
Fine tuning -- not for the current release.
Previewing a page that has parameters in the route is counter intuitive -- the extension injects [name_of_parameter] into the url and opens that page.
Given the information that's available to the extension, I think it will be quite difficult to correctly navigate to a parameterized route.
If it's not possible to find these routes, I think it'd be preferable to simply not offer "right click to preview", or the editor action preview button on any markdown that is in a parameterized route.
If it's not possible to distinguish these routes, I would remove right click to preview, and the preview editor action for all evidence pages.
See: https://docs.evidence.dev/core-concepts/templated-pages/
Minimal required NodeJS version for an Evidence app runtime is v16.14
:
https://docs.evidence.dev/getting-started/install-evidence#system-requirements
v16.14
We'll split the multi-step install/run process triggered by dev server start into two separate actions to resolve hanging blank preview page issue.
node_modules
folderStart dev server
as we have now after that npm install
command stepOriginally posted by @RandomFractals in #22 (comment)
**/package.json
in an open project folder and activate Evidence extension and commands, in addition to Evidence project detection and commands enablement checks from #18Workspace Contains activation event docs:
https://code.visualstudio.com/api/references/activation-events#workspaceContains
Originally posted by @RandomFractals in #25 (comment)
Not urgent
Extend #2 to allow a user to create an evidence project without creating a new folder and opening it in vscode.
The problem with the current emd
language config is that it overwrites default markdown document Preview, Outline and rendering when .md
documents are created or open in VS Code. See #9 for more info.
This should resolve currently missing standard markdown Outline display issue and will add extra elements to that side panel tree view for the Evidence web components and maybe frontmatter/header parts.
to open Evidence app settings file and change app configuration options in VSCode editor.
Evidence app settings file is used to configure app data sources.
The evidence.settings.json
configuration file is located in .evidence/template
folder.
Fine tuning -- not for current release
Command palette: "Start server"
Status bar tooltip: "Start dev server"
Command palette: "Stop server"
Status bar tooltip: "Stop dev server"
The command palette command should also be "start/stop dev server" IMO.
In either case, the terminology should be the same.
getWorkspaceFolder()
to src/config.ts
workspace.workspaceFolders[0]
references and lookups in implemented commands, file utils, etc.-- --host 0.0.0.0
param to npm run dev
terminal command when starting dev server in Codespaces nodejs containertemplate
with GitHub Codespaces in a browser to readme.md
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.