Add language support and grammar for Fenn

This commit is contained in:
2024-09-30 11:48:08 -07:00
parent c671aebe80
commit 6f859c24c8
7 changed files with 152 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
.direnv/
.vscode/
extension.js
node_modules/

13
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}

View File

@@ -1,5 +1,5 @@
import { ExtensionContext } from "vscode";
export function activate(context: ExtensionContext) { }
export function activate(_context: ExtensionContext) { }
export function deactivate() { }

31
fenn.json Normal file
View File

@@ -0,0 +1,31 @@
{
"comments": {
"lineComment": "#"
},
"brackets": [
[
"(",
")"
]
],
"autoClosingPairs": [
[
"(",
")"
],
[
"\"",
"\""
]
],
"surroundingPairs": [
[
"(",
")"
],
[
"\"",
"\""
]
]
}

72
fenn.tmLanguage.json Normal file
View File

@@ -0,0 +1,72 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Fenn",
"patterns": [
{
"include": "#storage"
},
{
"include": "#keyword"
},
{
"include": "#identifier"
},
{
"include": "#string"
},
{
"include": "#number"
},
{
"include": "#constant"
},
{
"include": "#operator"
},
{
"include": "#comment"
}
],
"repository": {
"storage": {
"name": "storage.type.fenn",
"match": "(?i)\\b(var|const)\\b"
},
"keyword": {
"name": "keyword.other.fenn",
"match": "(?i)\\b(print)\\b"
},
"identifier": {
"name": "variable.other.fenn",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
},
"string": {
"name": "string.quoted.double.fenn",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.fenn",
"match": "\\\\."
}
]
},
"number": {
"name": "constant.numeric.fenn",
"match": "\\b\\d+(\\.\\d+)?\\b"
},
"constant": {
"name": "constant.language.fenn",
"match": "(?i)\\b(true|false|none)\\b"
},
"operator": {
"name": "keyword.operator.fenn",
"match": "\\+|-|\\*|/|&|[!=<>]=?"
},
"comment": {
"name": "comment.line.number-sign.fenn",
"match": "#.*$"
}
},
"scopeName": "source.fenn"
}

View File

@@ -2,12 +2,41 @@
"name": "fennlang-vscode",
"version": "0.1.0",
"description": "Fennlang extension for Visual Studio Code",
"private": true,
"engines": {
"vscode": "^1.74.0"
},
"main": "extension.js",
"contributes": {},
"categories": [
"Programming Languages"
],
"activationEvents": [
"onLanguage:semanticLanguage"
],
"contributes": {
"languages": [
{
"id": "fenn",
"aliases": [
"Fenn",
"fenn"
],
"extensions": [
".fenn"
],
"configuration": "./fenn.json"
}
],
"grammars": [
{
"language": "fenn",
"scopeName": "source.fenn",
"path": "./fenn.tmLanguage.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run build",
"build": "tsc"
},
"author": "Nettika <git@nettika.cat>",

View File

@@ -1,7 +1,7 @@
{
"compilerOptions": {
"lib": [
"ESNext"
]
}
"compilerOptions": {
"lib": [
"ESNext"
]
}
}