Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature "Go to Declaretion" and file icon #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ lux/
lux_logs/

*.vsix

out
dist
node_modules
.vscode-test/
*.vsix
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@ lux/**
.gitignore
.vscodeignore
lux-colorizer.code-workspace

.vscode-test/**
src/**
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to the "lux-colorizer" extension will be documented in this file.

## [1.0.1] - 2023-07-01

### Added

- Add feature "Go to Declartion"
- Add lux file icon

## [1.0.0] - 2023-06-30

### Added
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@ To use snippets, start typing a meta statement, like `[loop]`, and VS Code will
offer possible options. Use TAB to autocomplete a statement and jumping between
input fields.

## Features

### Go to Declaretion

1. Click into variable or include file path
2. Press key F12 (Default shortcut)

For include file path with environment variable (e.g. $W $TEST_DIR)
You need to add custom variable for those variables, by:
1. Ctrl/Command + Shift + P
2. Type "User settings JSON" -> press Enter
3. Add the below value into the json file opened
```
"lux.envVariables": {
"W": "<your_absolute_file_path>",
"TEST_DIR": "<your_absolute_file_path>"
},
```
4. Save the file and retry

## How to contribute

1. Clone the repo
2. Run `npm install`
3. Add your magic
4. Test extension (following [this guide](https://code.visualstudio.com/api/working-with-extensions/testing-extension))
5. (optional) To build extension file
1. Run `npm install -g @vscode/vsce`
2. Run `vsce package` (it will build .vsix file)

## Useful References

1. Lux
Expand Down
10 changes: 10 additions & 0 deletions assets/examples/lux-examples/calc.lux
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

[shell other]
[invoke verify 12]
[invoke test_function_name]
[invoke test-function-name]

# Test an error case
[shell calc]
Expand Down Expand Up @@ -71,3 +73,11 @@
?^xxx${expected}yyy
?SH-PROMPT:
[endmacro]

[macro test_function_name]
?SH-PROMPT:
[endmacro]

[macro test-function-name]
?SH-PROMPT:
[endmacro]
1 change: 1 addition & 0 deletions assets/examples/lux-examples/common.luxinc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[global TEST=test]
10 changes: 9 additions & 1 deletion assets/examples/lux-examples/fail.lux
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

[global fail_pattern=[Ee][Rr][Rr][Oo][Rr]]
[global eprompt=\d+>\s]
[include loop.lux]

[doc2 Provoke a failure to get something interesting in the logs]

# need to set this in config
# "lux.variables": {
# "PRE_DIR": ".."
# },
[include ${PRE_DIR}/example1.lux]
# [include ${PRE_DIR_2}/example2.lux]

[shell calculator]
-$fail_pattern|SH-PROMPT:
-$fail_pattern|SH-PROMPT:|$device
!erl

# Multi-line expect
Expand Down
1 change: 1 addition & 0 deletions assets/examples/lux-examples/intro.lux
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Assign a global variable which is accessible in all shells
[global file=removeme.txt]
[global test5=removeme.txt]

# Start a shell
[shell single]
Expand Down
10 changes: 10 additions & 0 deletions assets/examples/lux-examples/loop.lux
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
[doc Demo the loop statement]

[global file=loop_break.tmp]
[my file3=loop_break.tmp]
[local file4=loop_break.tmp]

[include intro.lux]
[include ../test.luxinc]

[macro a test file2]
!echo 123
?$file2 $test $file $file3 $file4 $test5
?$test_here
[endmacro]
###
### Vanilla style of loops
###
Expand Down
3 changes: 3 additions & 0 deletions assets/examples/test.luxinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[global test_here=1]

[global PRE_DIR_2=..]
Loading