mark-wiemer / hello-vscode-extension

My first VS Code extension from the ground up

Home Page:https://marketplace.visualstudio.com/items?itemName=mark-wiemer.helloworld-2022

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello, world!

This is my first VS Code extension from the ground up! It's my sandbox, not really meant for public consumption :)

It follows the guide at Visual Studio Code - Your First Extension.

I'll try to leave extensive comments for reference to those writing their first VS Code extension :) feel free to open an issue if you have any questions about first time extension development!

Tests

Test-driven development is a major priority of this project. All code will be thoroughly tested before being committed.

All tests run using the standard npm run test, documented in package.json.

Unit tests focus on miscellaneous functionality of the app. They're written following the official Testing Extensions guide.

Grammar tests focus on the tokenization via the TextMate grammar detailed in Syntax Highlight Guide

Engineering quality

Another main goal is to create a project that's very easy to maintain.

  • Make use of automation whenever possible
  • Automated checks at PR time
  • Pre-commit hooks for formatting and linting

Pre-commit hooks

Pre-commit hooks are setup using husky and lint-staged. When a commit is attempted, lint-staged validates the staged files for correctness (compilation errors, lint problems, and formatting). If anything is wrong, the commit will fail.

To test that pre-commit hooks have been set up correctly, introduce compilation, lint, or formatting issues to a file. Save the file without fixing these issues. Then stage it and try to commit. The relevant check should fail, the commit should be aborted, and the filesystem should not be changed.

Syntax highlighting

Syntax highlighting support follows VS Code's syntax highlighting guide.

This extension...

  1. declares that it contributes languages and grammars in package.json
  2. defines grammar in YAML for readability (see Using YAML to write a grammar)
  3. converts YAML grammar to JSON using npm run compile_grammar

VS Code...

  1. tries to parse relevant files with the grammar using microsoft/vscode-textmate

Next steps

I want to improve AutoHotkey Plus Plus. Right now, I'm focusing on syntax- and semantic-highlighting.

The Semantic Token Provider mentioned in the Tokenization section of the Syntax Highlight Guide looks like a promising way to provide detailed tokens as well.

Resources:

Further reading

See the /docs folder for additional documentation.

About

My first VS Code extension from the ground up

https://marketplace.visualstudio.com/items?itemName=mark-wiemer.helloworld-2022

License:MIT License


Languages

Language:TypeScript 99.0%Language:Shell 1.0%