Skip to content
Draft
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
1 change: 1 addition & 0 deletions editors/code/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin/
LICENSE
out/
43 changes: 43 additions & 0 deletions editors/code/SYNTAX_TREE_USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# VSCode Extension: Show Syntax Tree

This extension adds a command `Roughly: Show Syntax Tree` that displays the AST (Abstract Syntax Tree) of the current R file.

## Usage

1. Open an R file in VSCode
2. Use the command palette (Ctrl+Shift+P / Cmd+Shift+P)
3. Type "Roughly: Show Syntax Tree"
4. The AST will open in a new editor tab beside your current file

## Example

For an R file with content:
```r
# Test function
hello <- function(name) {
paste("Hello", name)
}

result <- hello("World")
```

The command will show the AST structure with details about:
- Program structure
- Function definitions
- Variables assignments
- Function calls
- Comments
- And more...

## Requirements

- The `roughly` binary must be available (installed via the extension or in PATH)
- The current file must be an R file (`.R` or `.r` extension)
- The file must be saved to disk

## Error Handling

- Shows error if no active editor is found
- Shows error if current file is not an R file
- Shows error if file is not saved
- Shows error if roughly binary fails to execute
17 changes: 17 additions & 0 deletions editors/code/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import js from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ['out/**', 'node_modules/**'],
},
{
files: ['src/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
},
}
)
Loading