Click in your components and open VSCode in the correct file and line number.

Overview

Inspect in VSCode

This is a simple extension for deno/fresh projects that allows you to inspect your components' source code in VSCode. This repository includes a sample site to show how it works. Activate the extension with backquote (`) and click on any component. Your browser will attempt to navigate to the source code file in your project.

Demo gif showing inspect to vscode

This is a native feature in live, the upcoming deno-native CMS.

Usage

Start the project:

cd example/
deno task start

Go to https://localhost:8080

Now hit the backquote key (`) and click on any DOM Element while the project is open in VSCode. Your browser should navigate to VSCode and open the correct file and line.

Implementing in your project

  • Add "inspect_vscode/": "https://deno.land/x/[email protected]/" and "std/":"https://deno.land/[email protected]/" to your import_map.json file.

  • Create islands/InspectVSCode.tsx:

/** @jsx h */
import InspectVSCode from "inspect_vscode/island.tsx";

export default InspectVSCode;
  • Create routes/inspect-vscode.ts:
import inspectVSCodeHandler from "inspect_vscode/handler.ts";

export const handler = inspectVSCodeHandler;
  • Import islands/InspectVSCode.tsx in a route and render it.

Done!

How this works

It's really quite simple!

First, the client-side script activates the hover.

When an element is clicked, its outerHTML is sent to the server as a POST to /inspect-vscode.

The route handler then parses the outerHTML and greps the first complete HTML element.

If that fails — which happens when the element is formatted in multiple lines — we fallback to greping the longest attribute. This generally works.

Known Limitations

  • Better implementations for multi-line search are welcome. Right now, we're using grep for wider compatibility. There is no native tool for multiline regex search in MacOS and I wouldn't want to require installing a new package for that.
  • Twind syntax (tw`...`) is not supported — in fact, any transformation on the element causes grep to fail. I would welcome a PR which adds support for transformed HTML by using fuzzy search, something like https://deno.land/x/[email protected]
  • Components which are very similar might not be detected precisely: the first occurence will be found every time.
You might also like...

Serve file server with single zip file as file system in Deno.

zipland Serve file server with one-single zip file in Deno. Support zip just zip32 with deflated or uncompressed serving plaintext deflate Examples Yo

Nov 2, 2022

Your non mega-corporate Open source PLM. Click the website down below for more information.

Your non mega-corporate Open source PLM. Click the website down below for more information.

PLMore PLMore is an open-source Product Lifecycle Management Software. It offers an alternative to the heavily priced archahic Windchill/Teamcenter so

Aug 23, 2022

Your non mega-corporate Open source PLM. Click the website down below for more information.

Your non mega-corporate Open source PLM. Click the website down below for more information.

PLMore PLMore is an open-source Product Lifecycle Management Software. It offers an alternative to the heavily priced archahic Windchill/Teamcenter so

Jun 20, 2022

An Awesome Toggle Menu created with HTML,CSS,JQuery,font-awesome and line by line comment.

An Awesome Toggle Menu created with HTML,CSS,JQuery,font-awesome and line by line comment.

Demo : https://blackx-732.github.io/AwesomeMenu/ Under open source license No ©copyright issues Anyone can be modify this code as well Specifically we

Feb 9, 2021

⚡Chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of scope" from #HackerOne #Bugcrowd #Intigriti ...

⚡Chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import

FastDork v0.1 This chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of sc

Dec 31, 2022

For NUS PhD Students and Staffs, just one click to open the research papers on Google Scholar/IEEE/ACM, etc. with this script.

For NUS PhD Students and Staffs, just one click to open the research papers on Google Scholar/IEEE/ACM, etc. with this script.

NUS Literature Quick Access For National University of Singapore's students and staffs, just with one single click you can open any paper without the

Nov 30, 2022

CLI utility that parses argv, loads your specified file, and passes the parsed argv into your file's exported function. Supports ESM/TypeScript/etc out of the box.

cleffa CLI tool that: Parses argv into an object (of command-line flags) and an array of positional arguments Loads a function from the specified file

Mar 6, 2022

Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

Dec 30, 2022

In Your Face shows you Doom 'Ouch Faces' that correlate to the number of errors in your code!

In Your Face shows you Doom 'Ouch Faces' that correlate to the number of errors in your code!

In Your Face Watch how I made this extension on YouTube here In Your Face is a VS Code extension that shows you Doom 'Ouch Faces' that correlate to th

Dec 25, 2022
Owner
deco
Design, develop and deliver complete commerce experiences.
deco
jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Raja Rama Mohan Thavalam 12 Aug 25, 2022
Feel free to create new file, don't hesitate to pull your code, the most important thing is that the file name here must match your nickname so that file does not conflict with other people.

Hacktoberfest Indonesia Apa Itu Hacktoberfest ? Hacktoberfest adalah acara tahunan yang bertujuan untuk mendorong berkontribusi kedalam ekosistem open

Juan Daniel 5 Dec 15, 2022
Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

khimaros 40 Dec 23, 2022
🖊️Open a VSCode temporary file instantly

vscode-tempfile This extension immediately creates a temporary file and opens it in a new tab. Configuration You can specify the new file path and ini

Tetsu 1 Oct 5, 2022
It shows an effective way to correct bus arrival information using data analytics based on Amazon Serverless such as Kiness Data Stream, Kinesis Data Firehose, S3, and Lambda.

Amazon Serverless를 이용한 실시간 버스 정보 수집 및 저장 본 github repository는 버스 정보를 주기적으로 수집하여 분석할 수 있도록, Amazon Serverless인 Amazon Kinesis Data Stream, Kinesis Data

John Park 4 Nov 13, 2022
For some realizations of the title and thinking of the book Introduction to Algorithms, if there is something wrong, please correct me.

Introduction-to-Algorithms Introduce Origin of this library Some implementations of the topics in Introduction to Algorithms and some reflections on t

biao 2 Jun 9, 2022
In this project, I built a to-do list app, which is inspired by the minimalist website. Build withHTML/CSS & JavaScript best practices: Correct use of tags, elements, properties and syntax.

Webpack Exercise In this project, I built a to-do list app, which is inspired by the minimalist website. Built With HTML/CSS & JavaScript best practic

Vanessa Oliveros 3 Oct 11, 2022
🚨 Make the case correct, PLEASE!

?? CasePolice GitHub, not Github TypeScript, not Typescript macOS, not MacOS VS Code, not Vscode ... Make the case correct, PLEASE! Usage Make sure yo

Anthony Fu 944 Dec 26, 2022
Library to download binary files from GitHub releases detecting the correct platform.

Dbin TypeScript library to download binary files from GitHub releases detecting the correct platform. Example: import dbin from "https://deno.land/x/d

Óscar Otero 7 Oct 4, 2022
A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil ?? A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Ben Smith 21 Jun 20, 2022