Skip to content

fix: update syntax #3

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -9,4 +9,7 @@ yarn.lock

package-lock.json

.vscode
test.whi

out
.vscode-test
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"outFiles": [
"${workspaceRoot}/client/out/**/*.js"
],
"preLaunchTask": {
"type": "npm",
"script": "watch"
},
}
],
"compounds": [
{
"name": "Client + Server",
"configurations": [
"Launch Client",
]
}
]
}
33 changes: 33 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
src
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-2022 the Whistle authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# whistle-lang vscode support
# whistle-lang vscode support
44 changes: 44 additions & 0 deletions icons/icon_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions icons/icon_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 66 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@
"author": "Whistle Team",
"publisher": "whistle",
"icon": "icons/icon128.png",
"license": "MIT",
"description": "Support for the whistle language",
"version": "1.7.0",
"version": "1.8.4",
"engines": {
"vscode": "^1.47.0"
"vscode": "1.82.0"
},
"repository": {
"type": "git",
@@ -26,31 +27,90 @@
"languages": [
{
"id": "whistle",
"icon": {
"light": "icons/icon_light.svg",
"dark": "icons/icon_dark.svg"
},
"aliases": [
"Whistle",
"whistle"
],
"extensions": [
"whi"
".whi"
],
"configuration": "./language-configuration.json"
}
],
"configuration": {
"type": "object",
"title": "whistle",
"properties": {
"whistle.trace.server": {
"type": "string",
"scope": "window",
"enum": [
"off",
"messages",
"verbose"
],
"enumDescriptions": [
"No traces",
"Error only",
"Full log"
],
"default": "off",
"description": "Traces the communication between VS Code and the language server."
},
"whistle.whistlePath": {
"type": "string",
"default": "whistle",
"markdownDescription": "A path to the `whistle` executable. The extension looks for `whistle` in the `PATH` By default",
"scope": "window"
}
}
},
"grammars": [
{
"language": "whistle",
"scopeName": "source.whistle",
"path": "./syntaxes/whistle.tmLanguage.json"
}
],
"commands": [
{
"command": "whistle.restartServer",
"title": "Restart Whistle Server",
"category": "whistle"
}
]
},
"activationEvents": [
"onDebugInitialConfigurations"
],
"enabledApiProposals": [],
"main": "./out/extension",
"devDependencies": {
"js-yaml": "^3.14.0",
"vsce": "^1.87.1"
"@types/mocha": "10.0.1",
"@types/node": "20.6.2",
"@types/semver": "7.5.2",
"@types/vscode": "1.82.0",
"js-yaml": "4.1.0",
"vsce": "2.15.0",
"vscode": "1.1.37",
"vscode-test": "1.6.1"
},
"dependencies": {
"esbuild": "0.19.3",
"lodash-es": "4.17.21",
"lodash.debounce": "4.0.8",
"vscode-languageclient": "9.0.0"
},
"scripts": {
"compile": "esbuild --bundle --sourcemap=external --minify --external:vscode src/extension.ts --outdir=out --platform=node --format=cjs",
"build": "js-yaml syntaxes/whistle.tmLanguage.yml > syntaxes/whistle.tmLanguage.json && js-yaml snippets/whistle.yml > snippets/whistle.json",
"package": "vsce package",
"package:npm": "vsce package --no-yarn"
"package:npm": "vsce package --no-yarn",
"test": "npm run compile && npm run package:npm && node ./node_modules/vscode/bin/test",
"all": "npm run compile && npm run build && npm run package:npm"
}
}
27 changes: 11 additions & 16 deletions snippets/whistle.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
---
Import external module:
prefix: import statement
Import module:
prefix: import
body:
- import { $0 } from "${1:module}"
description: Import external module.
Print string to the console:
prefix: pstr
body:
- printString($1)
- "$0"
description: Print string to the console
Print int to the console:
prefix: pint
body:
- printInt($1)
- "$0"
description: Print int to the console
- import from "${0:module}"
description: Import a whistle file.
Function Statement:
prefix: fn
body:
- fn ${1:name}(${2:params}:${3:type}) {
- "\t$TM_SELECTED_TEXT$0"
- "}"
description: Function Statement
Extern module:
prefix: extern
body:
- extern "${0:namespace}" {
- "\tfn ${1:name}(${2:params}:${3:type}):${4:return_type},"
- "}"
description: Import an external function
If Statement:
prefix: if
body:
Loading