vscode-gradle-language
Introduction
An extension to provide Gradle language support for Visual Studio Code, including advanced functionalities like Syntax Highlighting, Keyword Auto-completion Proposals and Duplication Validation.
Homepage: Visual Studio Code Marketplace
Stucture
The extension observes all .gradle
documents and uses the server to provide validation and auto-completion proposals (IntelliSense).
The code for the extension is in the client
folder, which uses the vscode-languageclient
node module to launch the language server.
The language server is located in the server
folder.
The tests are located in the test
folder.
Features
Syntax Highlighting
- The extension converts the sublime-gradle's TextMate grammar configuration for Gradle language.
Keyword Auto-completion Proposals (IntelliSense)
The extension automatically detects the Java and Android plugin used in the Gradle scripts, then propose keywords smartly in different situations depending on the position of the cursor:
Duplication Validation
- The extension automatically validates the script under editing and warns the user about duplicated script blocks.
Tutorial
Requirements
How to launch the extension
- Pull the repo and
cd
to the root directory.
- Run
npm install
to initialize the extension and the server.
- Run
npm run compile
in the terminal to compile the extension and the server.
- Open the root folder in Visual Studio Code, then set the
Preferences -> Color Theme
to Dark+ (default dark)
.
- In the Debug viewlet, run
Launch Client
from drop-down menu (or press F5
) to launch the extension and attach to the extension.
- Create and open a file
build.gradle
and type 'app'
into it. You should see keywords proposed including 'apply'
.
How to debug the server
- In the Debug viewlet, run
Attach to Server
launch config and set breakpoints in the client or the server.
How to run the tests
- In the Debug viewlet, run
Launch Unit Tests
from drop-down menu to run the unit tests.
Known Issues
- Syntax highlighting doesn't always work consistently with task constructor with parameters in parentheses, i.e.
task foo(type: Bar) {...}
and task foo {...}
Release Notes
0.2.3
Updated the display name.
Fixed a bug that fails to parse task constructor's name without parameters.
0.2.2
Added unit tests.
Fixed some minor bugs.
0.2.0
Added Task Dependency proposals.
Fixed some bugs in Task parser.
0.1.3
Republished after installing node modules and compiling server source codes.
0.1.0
Initial release.