Merge pull request 'tcl_language_support' (#9) from tcl_language_support into main
/ build_and_publish (push) Failing after 5s
/ build_and_publish (push) Failing after 5s
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
@@ -1,37 +1,41 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- "*"
|
||||||
jobs:
|
jobs:
|
||||||
build_and_publish:
|
build_and_publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: GitHub Tag Name example
|
- name: GitHub Tag Name example
|
||||||
run: |
|
run: |
|
||||||
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
|
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
|
||||||
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
|
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
|
||||||
- name: Install NodeJS
|
- name: Install NodeJS
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Install NPM Packages
|
- name: Install NPM Packages
|
||||||
run: npm i
|
run: |
|
||||||
- name: Install VSCE
|
npm i /
|
||||||
run: npm -g i @vscode/vsce
|
cd ./client
|
||||||
- name: Build Package Files
|
npm i
|
||||||
run: npm run package
|
cd ..
|
||||||
- name: Update package.json Version
|
- name: Install VSCE
|
||||||
run: npm version ${{ github.ref_name }} --no-git-tag-version
|
run: npm -g i @vscode/vsce
|
||||||
- name: Commit and Push Changes
|
- name: Build Package Files
|
||||||
run: |
|
run: npm run package
|
||||||
git config user.name "${{ vars.USERNAME_GIT }}"
|
- name: Update package.json Version
|
||||||
git config user.email "${{ vars.EMAIL_GIT }}"
|
run: npm version ${{ github.ref_name }} --no-git-tag-version
|
||||||
git add package.json
|
- name: Commit and Push Changes
|
||||||
git commit -m "Update version to ${{ github.ref_name }}"
|
run: |
|
||||||
git push origin HEAD:main
|
git config user.name "${{ vars.USERNAME_GIT }}"
|
||||||
- name: Publish to Visual Studio Marketplace
|
git config user.email "${{ vars.EMAIL_GIT }}"
|
||||||
run: vsce publish
|
git add package.json
|
||||||
env:
|
git commit -m "Update version to ${{ github.ref_name }}"
|
||||||
VSCE_PAT: ${{ secrets.VSCODE_MARKETPALCE }}
|
git push origin HEAD:main
|
||||||
|
- name: Publish to Visual Studio Marketplace
|
||||||
|
run: vsce publish
|
||||||
|
env:
|
||||||
|
VSCE_PAT: ${{ secrets.VSCODE_MARKETPALCE }}
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
# tokens.py
|
|
||||||
from typing import List
|
|
||||||
import attrs
|
|
||||||
import enum
|
|
||||||
from lark import Tree, Token
|
|
||||||
|
|
||||||
# Legend must match the client
|
|
||||||
SEMANTIC_TOKEN_TYPES = {
|
|
||||||
"keyword": 0,
|
|
||||||
"variable": 2,
|
|
||||||
"string": 3,
|
|
||||||
}
|
|
||||||
SEMANTIC_TOKEN_MODIFIERS = {
|
|
||||||
"declaration": 1 << 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TokenModifier(enum.IntFlag):
|
|
||||||
deprecated = enum.auto()
|
|
||||||
readonly = enum.auto()
|
|
||||||
defaultLibrary = enum.auto()
|
|
||||||
definition = enum.auto()
|
|
||||||
|
|
||||||
|
|
||||||
@attrs.define
|
|
||||||
class TokenData:
|
|
||||||
line: int
|
|
||||||
offset: int
|
|
||||||
text: str
|
|
||||||
|
|
||||||
tok_type: str = ""
|
|
||||||
tok_modifiers: List[TokenModifier] = attrs.field(factory=list)
|
|
||||||
|
|
||||||
|
|
||||||
TokenTypes = ["keyword", "variable", "function", "operator", "parameter", "type"]
|
|
||||||
|
|
||||||
|
|
||||||
def collect_semantic_tokens(tree: Tree) -> list[int]:
|
|
||||||
"""
|
|
||||||
Walk the parse tree and return a flat LSP semanticTokens/full array:
|
|
||||||
[line, char, length, tokenType, tokenModifiers, …]
|
|
||||||
"""
|
|
||||||
data = []
|
|
||||||
for tok in tree.scan_values(lambda v: isinstance(v, Token)):
|
|
||||||
# 'set' keyword
|
|
||||||
if tok.type == "SET":
|
|
||||||
data.append(
|
|
||||||
[
|
|
||||||
tok.line - 1,
|
|
||||||
tok.column - 1,
|
|
||||||
len(tok.value),
|
|
||||||
SEMANTIC_TOKEN_TYPES["keyword"],
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
# variable being declared
|
|
||||||
elif tok.type == "NAME":
|
|
||||||
data.append(
|
|
||||||
[
|
|
||||||
tok.line - 1,
|
|
||||||
tok.column - 1,
|
|
||||||
len(tok.value),
|
|
||||||
SEMANTIC_TOKEN_TYPES["variable"],
|
|
||||||
SEMANTIC_TOKEN_MODIFIERS["declaration"],
|
|
||||||
]
|
|
||||||
)
|
|
||||||
# string literal
|
|
||||||
elif tok.type == "STRING":
|
|
||||||
data.append(
|
|
||||||
[
|
|
||||||
tok.line - 1,
|
|
||||||
tok.column - 1,
|
|
||||||
len(tok.value),
|
|
||||||
SEMANTIC_TOKEN_TYPES["string"],
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# sort by position and flatten
|
|
||||||
data.sort(key=lambda x: (x[0], x[1]))
|
|
||||||
return [p for token in data for p in token]
|
|
||||||
Reference in New Issue
Block a user