From 204299827e04cef991fca39d8ea3c4658dff644e Mon Sep 17 00:00:00 2001 From: sfj Date: Wed, 10 Sep 2025 09:54:46 +0200 Subject: [PATCH] add vscode extension --- vscode/install.sh | 9 ++++ vscode/phi/.vscode/launch.json | 17 +++++++ vscode/phi/.vscodeignore | 4 ++ vscode/phi/CHANGELOG.md | 9 ++++ vscode/phi/README.md | 65 +++++++++++++++++++++++++ vscode/phi/language-configuration.json | 28 +++++++++++ vscode/phi/package.json | 25 ++++++++++ vscode/phi/syntaxes/phi.tmLanguage.json | 57 ++++++++++++++++++++++ vscode/phi/vsc-extension-quickstart.md | 29 +++++++++++ 9 files changed, 243 insertions(+) create mode 100644 vscode/install.sh create mode 100644 vscode/phi/.vscode/launch.json create mode 100644 vscode/phi/.vscodeignore create mode 100644 vscode/phi/CHANGELOG.md create mode 100644 vscode/phi/README.md create mode 100644 vscode/phi/language-configuration.json create mode 100644 vscode/phi/package.json create mode 100644 vscode/phi/syntaxes/phi.tmLanguage.json create mode 100644 vscode/phi/vsc-extension-quickstart.md diff --git a/vscode/install.sh b/vscode/install.sh new file mode 100644 index 0000000..c485fa5 --- /dev/null +++ b/vscode/install.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -xe + +SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") +CODE_PATH=$1 + +rm -rf "$CODE_PATH/extensions/phi" +cp -r "$SCRIPT_DIR/phi" "$CODE_PATH/extensions/" diff --git a/vscode/phi/.vscode/launch.json b/vscode/phi/.vscode/launch.json new file mode 100644 index 0000000..44a86ab --- /dev/null +++ b/vscode/phi/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} diff --git a/vscode/phi/.vscodeignore b/vscode/phi/.vscodeignore new file mode 100644 index 0000000..f369b5e --- /dev/null +++ b/vscode/phi/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/vscode/phi/CHANGELOG.md b/vscode/phi/CHANGELOG.md new file mode 100644 index 0000000..f9b38fb --- /dev/null +++ b/vscode/phi/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log + +All notable changes to the "phi" extension will be documented in this file. + +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. + +## [Unreleased] + +- Initial release \ No newline at end of file diff --git a/vscode/phi/README.md b/vscode/phi/README.md new file mode 100644 index 0000000..eead289 --- /dev/null +++ b/vscode/phi/README.md @@ -0,0 +1,65 @@ +# phi README + +This is the README for your extension "phi". After writing up a brief description, we recommend including the following sections. + +## Features + +Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. + +For example if there is an image subfolder under your extension project workspace: + +\!\[feature X\]\(images/feature-x.png\) + +> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. + +## Requirements + +If you have any requirements or dependencies, add a section describing those and how to install and configure them. + +## Extension Settings + +Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. + +For example: + +This extension contributes the following settings: + +* `myExtension.enable`: Enable/disable this extension. +* `myExtension.thing`: Set to `blah` to do something. + +## Known Issues + +Calling out known issues can help limit users opening duplicate issues against your extension. + +## Release Notes + +Users appreciate release notes as you update your extension. + +### 1.0.0 + +Initial release of ... + +### 1.0.1 + +Fixed issue #. + +### 1.1.0 + +Added features X, Y, and Z. + +--- + +## Working with Markdown + +You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: + +* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). +* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). +* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. + +## For more information + +* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) +* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) + +**Enjoy!** diff --git a/vscode/phi/language-configuration.json b/vscode/phi/language-configuration.json new file mode 100644 index 0000000..b6bdd1e --- /dev/null +++ b/vscode/phi/language-configuration.json @@ -0,0 +1,28 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "//", + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + // symbols that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} \ No newline at end of file diff --git a/vscode/phi/package.json b/vscode/phi/package.json new file mode 100644 index 0000000..f00c3d8 --- /dev/null +++ b/vscode/phi/package.json @@ -0,0 +1,25 @@ +{ + "name": "phi", + "displayName": "phi", + "description": "", + "version": "0.0.1", + "engines": { + "vscode": "^1.103.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [{ + "id": "phi", + "aliases": ["phi", "phi"], + "extensions": ["phi"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "phi", + "scopeName": "source.phi", + "path": "./syntaxes/phi.tmLanguage.json" + }] + } +} diff --git a/vscode/phi/syntaxes/phi.tmLanguage.json b/vscode/phi/syntaxes/phi.tmLanguage.json new file mode 100644 index 0000000..c00b970 --- /dev/null +++ b/vscode/phi/syntaxes/phi.tmLanguage.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "phi", + "patterns": [ + { + "include": "#keywords" + }, + { + "include": "#strings" + }, + { + "include": "#idents" + } + ], + "repository": { + "keywords": { + "patterns": [ + { + "name": "keyword.control.phi", + "match": "\\b(fn|call|return|loop|break|if|let|do)\\b" + }, + { + "name": "keyword.operator.phi", + "match": "\\b(and|or|not)\\b" + }, + { + "name": "keyword.operator.phi", + "match": "\\+|\\-|\\*|\\/|=|(\\+=)|(\\-=)|(==)|(!=)|<|>|(<=)|(>=)" + }, + { + "name": "constant.phi", + "match": "\\b(null|true|false)\\b" + } + ] + }, + "strings": { + "name": "string.quoted.double.phi", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.phi", + "match": "\\\\." + } + ] + }, + "idents": { + "patterns": [ + { + "name": "variable.phi", + "match": "\\b[a-zA-Z0-9_]+\\b" + } + ] + } + }, + "scopeName": "source.phi" +} \ No newline at end of file diff --git a/vscode/phi/vsc-extension-quickstart.md b/vscode/phi/vsc-extension-quickstart.md new file mode 100644 index 0000000..2b8eaa1 --- /dev/null +++ b/vscode/phi/vsc-extension-quickstart.md @@ -0,0 +1,29 @@ +# Welcome to your VS Code Extension + +## What's in the folder + +* This folder contains all of the files necessary for your extension. +* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension. +* `syntaxes/phi.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization. +* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets. + +## Get up and running straight away + +* Make sure the language configuration settings in `language-configuration.json` are accurate. +* Press `F5` to open a new window with your extension loaded. +* Create a new file with a file name suffix matching your language. +* Verify that syntax highlighting works and that the language configuration settings are working. + +## Make changes + +* You can relaunch the extension from the debug toolbar after making changes to the files listed above. +* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. + +## Add more language features + +* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/api/language-extensions/overview + +## Install your extension + +* To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. +* To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension.