Skip to content

Commit d14800d

Browse files
committed
Extension
1 parent cbba826 commit d14800d

9 files changed

+225
-1
lines changed

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// A launch configuration that launches the extension inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}"
15+
]
16+
}
17+
]
18+
}

.vscodeignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
All notable changes to the "tpp" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
- Initial release

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
# tpp-syntax-highlight
1+
# T++ Syntax Highlight Extension
22
This is an extension for T++ Programming Language Syntax Highlighting.
3+
4+
## How to Use
5+
In this repository there is an file called: ***tpp-extension.vsix***, to run this extension you have to go to *VS Code* and in the tab 'Extensions' click in the 'Install from ***VSIX***...'
6+
7+
## The First Steps
8+
To create a new extension for *VS Code*, it is need to run the following command to install the dependencies:
9+
```sh
10+
npm install -g yo generator-code vsce
11+
```
12+
13+
and:
14+
```sh
15+
yo code
16+
```
17+
18+
to create the initial structure for the ***New Language Support*** Extension.
19+
20+
After putting everthing we want to the new programming language, you need to create the *.vsix* file, using the command:
21+
```sh
22+
vsce package
23+
```

language-configuration.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"comments": {
3+
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
4+
"blockComment": [ "{", "}" ]
5+
},
6+
// symbols used as brackets
7+
"brackets": [
8+
["{", "}"],
9+
["[", "]"],
10+
["(", ")"]
11+
],
12+
"autoClosingPairs": [
13+
{ "open": "[", "close": "]" },
14+
{ "open": "(", "close": ")" },
15+
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
16+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
17+
{ "open": "`", "close": "`", "notIn": ["string", "comment"] },
18+
{ "open": "{", "close": "}" }
19+
],
20+
// symbols that that can be used to surround a selection
21+
"surroundingPairs": [
22+
["{", "}"],
23+
["[", "]"],
24+
["(", ")"],
25+
["\"", "\""],
26+
["'", "'"]
27+
],
28+
29+
"indentationRules": {
30+
"increaseIndentPattern": "\\b(então|senão|repita)\\b",
31+
"decreaseIndentPattern": "\\b(fim|até )\\b"
32+
}
33+
}

package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "tpp",
3+
"displayName": "tpp",
4+
"description": "T++",
5+
"version": "0.0.1",
6+
"publisher": "vitorCamargo",
7+
"engines": {
8+
"vscode": "^1.37.0"
9+
},
10+
"categories": [
11+
"Programming Languages"
12+
],
13+
"contributes": {
14+
"languages": [{
15+
"id": "tpp",
16+
"aliases": ["T++", "tpp"],
17+
"extensions": [".tpp"],
18+
"configuration": "./language-configuration.json"
19+
}],
20+
"grammars": [{
21+
"language": "tpp",
22+
"scopeName": "main.tpp",
23+
"path": "./syntaxes/tpp.tmLanguage.json"
24+
}]
25+
}
26+
}

syntaxes/tpp.tmLanguage.json

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "T++",
4+
"patterns": [
5+
{
6+
"include": "#keywords"
7+
},
8+
{
9+
"include": "#strings"
10+
},
11+
{
12+
"include": "#string"
13+
},
14+
{
15+
"include": "#comments"
16+
},
17+
{
18+
"include": "#function"
19+
}
20+
],
21+
"repository": {
22+
"keywords": {
23+
"patterns": [{
24+
"name": "keyword.control.tpp",
25+
"match": "\\b(se|senão|então|repita|até|retorna|fim)\\b"
26+
}, {
27+
"name": "support.type.property-name.tpp",
28+
"match": "\\b(inteiro|flutuante|leia|escreva)\\b"
29+
}, {
30+
"name": "constant.character.tpp",
31+
"match": "\\b((\\d+(\\.\\d*)?[eE][-+]?\\d+)|(\\d+\\.\\d*)|\\d+)\\b"
32+
}, {
33+
"name": "keyword.operator.tpp",
34+
"match": "&&|\\|\\||:=|=|:|>|<|>=|<=|<>|\\+|\\-|\\*|\\/"
35+
}]
36+
},
37+
"strings": {
38+
"name": "string.quoted.double.tpp",
39+
"begin": "\"",
40+
"end": "\"",
41+
"patterns": [
42+
{
43+
"name": "constant.character.escape.tpp",
44+
"match": "\\\\."
45+
}
46+
]
47+
},
48+
"string": {
49+
"name": "string.quoted.double.tpp",
50+
"begin": "'",
51+
"end": "'",
52+
"patterns": [
53+
{
54+
"name": "constant.character.escape.tpp",
55+
"match": "\\\\."
56+
}
57+
]
58+
},
59+
"comments": {
60+
"name": "comment.block",
61+
"begin": "{",
62+
"end": "}",
63+
"patterns": [
64+
{
65+
"name": "constant.character.escape.tpp",
66+
"match": "\\\\."
67+
}
68+
]
69+
},
70+
"function": {
71+
"patterns": [{
72+
"name": "entity.name.function.tpp",
73+
"match": "\\b(principal)\\b"
74+
}, {
75+
"name": "entity.name.function.tpp",
76+
"match": "[a-zA-Z_áàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ][a-zA-Z_0-9áàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ]*(?=\\(.*\\))"
77+
}, {
78+
"name": "variable.parameter.tpp",
79+
"match": "(?<=\\()[^\n]+(?=\\))"
80+
}]
81+
}
82+
},
83+
"scopeName": "main.tpp"
84+
}

tpp-extension.vsix

3.17 KB
Binary file not shown.

vsc-extension-quickstart.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Welcome to your VS Code Extension
2+
3+
## What's in the folder
4+
5+
* This folder contains all of the files necessary for your extension.
6+
* `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.
7+
* `syntaxes/tpp.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
8+
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
9+
10+
## Get up and running straight away
11+
12+
* Make sure the language configuration settings in `language-configuration.json` are accurate.
13+
* Press `F5` to open a new window with your extension loaded.
14+
* Create a new file with a file name suffix matching your language.
15+
* Verify that syntax highlighting works and that the language configuration settings are working.
16+
17+
## Make changes
18+
19+
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
20+
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
21+
22+
## Add more language features
23+
24+
* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
25+
26+
## Install your extension
27+
28+
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
29+
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

0 commit comments

Comments
 (0)