|
|
|
Contributor: Vaibhav Raj
- GitHub: @dead8309
- LinkedIn: Vaibhav Raj
- Organization: St. Jude Children's Research Hospital
- Project: Extending Sprocket's Language Server Protocol for Enhanced WDL Support
- Mentor: Clay McLeod
The goal of this project was to significantly enhance the developer experience for scientists and engineers writing Workflow Description Language (WDL). WDL is crucial for defining data processing workflows, but its tooling often lacked the modern, intelligent features found in other languages.
This project supercharged the Sprocket VS Code extension by building out its Language Server Protocol (LSP) implementation in Rust. The mission was to transform writing WDL from a manual, error-prone process into a fluid, productive, and even enjoyable experience. I implemented a suite of essential LSP features, including intelligent code navigation, robust autocompletion, and semantic-aware highlighting, directly into the core of Sprocket's wdl-lsp.
My journey with St. Jude didn't start with the GSoC acceptance letter. I dove into the codebase early, contributing across the wdl, sprocket, and sprocket-vscode repositories. This initial phase was invaluable for understanding the architecture and the community's needs, allowing me to hit the ground running when GSoC officially began.
| Pull Request | Title |
|---|---|
wdl Repository |
|
| wdl#360 | fix: handle input dependencies in workflow graph evaluation |
| wdl#362 | fix: lsp errors out when a file uri is received instead of directory |
| wdl#370 | feat: Enforce Section Ordering for Struct definitions |
| wdl#371 | feat: Enable linking between related lint rules |
| wdl#374 | feat: Tags now implement TryFrom |
| wdl#376 | refactor(wdl-lint): replace TryFrom with FromStr |
| wdl#381 | fix: add chown workaround after task execution |
| wdl#398 | Fix: env vars are not using guest path in docker backend |
| wdl#404 | feat: validate regular expressions on the go |
| wdl#408 | refactor: make lint rules name consistent |
| wdl#423 | refactor: accept case insensitive --except args |
| wdl#424 | feat: concurrent file downloads for localization |
| wdl#428 | fix: output mount path must be absolute |
| wdl#431 | fix: prevent lsp crash from single file panics |
| wdl#444 | feat: add RedundantNone lint rule |
sprocket Repository |
|
| sprocket#81 | feat: extend explain command |
| sprocket#84 | feat: Add hide-notes to hide note diagnostics from reporting |
| sprocket#94 | feat: warn users about unknown --except rule |
| sprocket#105 | feat: add support for tab completions |
| sprocket#114 | feat: add shellcheck to dockerfile |
sprocket-vscode Repository |
|
| sprocket-vscode#20 | feat: Attempt to restart lsp atleast once |
During the official GSoC period, I implemented the following core Language Server features from the ground up, transforming the WDL development workflow.
Eliminated the need to manually search for definitions. Users can now instantly jump from a variable, task call, or struct usage to its original declaration, even if it's in a different, imported file. This is a fundamental feature for understanding complex workflows.
- Same file
goto_def-1.webm
- Across documents
goto_def-2.webm
- Structs
goto_def-3.webm
Relevant PRs:
- wdl#468: feat: add support for lsp
goto_definitions - wdl#491: feat: add support for more definition sites in
goto_definition
Provided the ability to find every single usage of a variable, task, workflow, or struct across the entire project. This is invaluable for refactoring and understanding the impact of a change.
- Struct References
find_all_ref-1.webm
- Call output References
find_all_ref-2.webm
and many more
Relevant PR:
- wdl#484: feat: add support for lsp
textDocument/references
Implemented safe, context-aware renaming. This feature intelligently renames a symbol (like a variable or task) and all of its references throughout the workspace, preventing the common errors associated with manual find-and-replace.
- Same file
rename-1.webm
- Across Documents
rename-2.webm
Relevant PRs:
Went beyond basic syntax highlighting by teaching the server the meaning of the code. Variables, types, tasks, workflows, and namespaces are now colored semantically, making WDL codebases significantly easier to read and parse visually.
Before (TextMate Grammar Only)
After (LSP Semantic Highlighting)
Relevant PR:
- wdl#569: feat: add support for semantic highlighting
Enabled developers to see type information and documentation on demand. By simply hovering over any symbol, a tooltip appears showing its full type signature, documentation from meta sections, and other relevant context.
and many more
Relevant PR:
- wdl#540: feat: add support for LSP hover
Reduced boilerplate and improved accuracy with intelligent suggestions.
- Autocompletion: Provides context-aware suggestions for keywords, built-in functions, and variables currently in scope.
- Dynamic Snippets: The LSP now generates snippets on the fly, such as a complete
callblock with all required inputs for any task in the workspace.
completions-1.webm
completions-2.webm
snippets.webm
Relevant PRs:
- wdl#519: feat: add support for auto-completions
- wdl#577: feat: add snippets support
- sprocket-vscode#34: refactor: remove old, static snippets from extension
Gave developers a high-level, structured view of their files. This feature populates the editor's "Outline" view with a tree of all tasks, workflows, structs, and declarations, making navigation in large files effortless.
Relevant PR:
- wdl#582: feat: add support for document symbols
Enabled users to find any task, workflow, or struct definition anywhere in the project by name, without needing to know which file it's in. A massive time-saver for large, multi-file projects.
Relevant PR:
- wdl#588: feat: add support for workspace symbols
Improved readability of complex command blocks by injecting Bash syntax highlighting. This makes shell scripts embedded within WDL much easier to write and debug, leveraging VS Code's built-in TextMate grammars.
| Before | After |
|---|---|
Relevant PR:
- sprocket-vscode#37: feat: add bash TextMate grammars
A powerful language server must be a reliable one. I prioritized stability by:
- Fixing Race Conditions: Ensured the server waits for analysis to complete before responding to requests, eliminating flaky behavior (wdl#487).
- Building an Integration Test Suite: Created a new testing framework from scratch to programmatically validate LSP features, safeguarding against future regressions (wdl#489).
With the goals of the GSoC project complete, the foundation is now rock-solid for even more advanced features in the future.
- Plugins/Extensions for other editors
- Advanced Code Actions
- Performance Optimizations
This GSoC has been an incredible learning experience. I dove deep into Rust, worked with tokio, mastering concepts like asynchronous programming, concurrency, and advanced type systems. I gained a thorough understanding of the Language Server Protocol and the complexities of building powerful developer tools.
I want to extend a massive thank you to my mentor, Clay McLeod, for his constant guidance, insightful code reviews, and unwavering support. His mentorship was instrumental to the success of this project. Thank you Peter Huene, Ari Frantz, Andrew Thrasher and Adam C. Foltzer for helping me throughout the GSoC and Pre-GSoC period and for being such a welcoming and collaborative community.
And finally, thank you to Google for running the Summer of Code program.