No description
- TypeScript 90.3%
- JavaScript 9.7%
| .vscode | ||
| icons | ||
| src | ||
| syntaxes | ||
| .gitattributes | ||
| .gitignore | ||
| .vscodeignore | ||
| esbuild.js | ||
| language-configuration.json | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
NC Language Support for Visual Studio Code
Rich language support for the NC programming language in Visual Studio Code, featuring IntelliSense, Go to Definition, Diagnostics, and more.
Quick Start
- Install the extension
- Ensure
nccis installed and in your PATH - Open or create a
.ncfile - Start coding with full language support!
Features
The extension provides comprehensive language support through the ncc lsp server:
Module System
Full support for NC's module system:
- Path-based imports:
import "std/io",import "std/crypto/hash/md5" - Module aliasing:
import "std/io" as io_lib - Member access:
io.println(),md5.sum_hex() - Module constants:
io.O_RDONLY,io.SEEK_END - Public exports:
pub fnfor exported functions
Code Intelligence
- Go to Definition (F12 or Ctrl+Click): Jump to symbol definitions
- Find All References (Shift+F12): Find all usages of a symbol
- Peek Definition (Alt+F12): Preview definitions inline
- Go to Type Definition: Navigate to type definitions
- Go to Implementation: Jump to implementations
Code Editing
- IntelliSense / Auto-completion (Ctrl+Space): Context-aware code completion
- Signature Help (Ctrl+Shift+Space): Parameter hints for functions
- Hover Information: View documentation and type information
- Document Symbols (Ctrl+Shift+O): Navigate file structure via outline
- Workspace Symbols (Ctrl+T): Search symbols across the workspace
- Rename Symbol (F2): Rename symbols with automatic refactoring
Code Quality
- Diagnostics: Real-time error and warning detection
- Code Actions (Ctrl+.): Quick fixes and refactoring suggestions
- Document Formatting (Shift+Alt+F): Auto-format your code
- Document Highlights: Highlight matching symbols in the document
Navigation
- Folding Ranges: Collapse/expand code blocks
- Call Hierarchy: View incoming and outgoing calls
- Type Hierarchy: Explore type relationships
- Breadcrumbs: Navigate code structure in the editor
Additional Features
- Semantic Highlighting: Enhanced syntax highlighting based on semantic analysis
- Inlay Hints: Inline type and parameter hints
- Code Lens: Actionable contextual information in code
Configuration
The extension provides several configuration options:
Language Server
The extension uses ncc lsp for language server functionality.
nc.languageServer.enabled: Enable/disable the NC language server (default:true)nc.languageServer.path: Path to the ncc executable (default:ncc)nc.languageServer.trace: Set tracing level for debugging (off,messages,verbose)nc.languageServer.maxNumberOfProblems: Maximum number of problems to report (default:100)
Feature Settings
nc.completion.enabled: Enable/disable code completion (default:true)nc.diagnostics.enabled: Enable/disable diagnostics (default:true)
Compiler Integration
nc.compiler.path: Path to the ncc compiler executable (default:ncc)nc.compiler.enabled: Enable/disable ncc compiler integration for error checking (default:true)
Setup
The extension requires the ncc compiler to be installed and available:
- Install
nccand ensure it's in your PATH, or - Set
nc.languageServer.pathto the full path to yournccexecutable
Example settings.json:
{
"nc.languageServer.path": "/usr/local/bin/ncc"
}
Commands
Available through the Command Palette (Ctrl+Shift+P):
- NC: Restart Language Server: Restart the language server if it becomes unresponsive
- NC: Show Output Channel: Show the language server output for debugging
- NC: Toggle Language Server Trace Level: Cycle through trace levels (off/messages/verbose)
- NC: Run File: Execute the current NC file (also Ctrl+F5)
Keyboard Shortcuts
- F12: Go to Definition
- Shift+F12: Find All References
- Alt+F12: Peek Definition
- F2: Rename Symbol
- Ctrl+.: Show Code Actions
- Ctrl+Space: Trigger IntelliSense
- Ctrl+Shift+Space: Signature Help
- Ctrl+Shift+O: Go to Symbol in File
- Ctrl+T: Go to Symbol in Workspace
- Shift+Alt+F: Format Document
- Ctrl+F5: Run Current File
- Ctrl+Click: Go to Definition (mouse)
Development
To contribute to this extension:
- Clone the repository
- Run
npm installto install dependencies - Open in VS Code and press F5 to run the extension in development mode
- Make changes to the TypeScript files in
src/ - Run
npm run compileto build - Test with NC files
Building
npm run compile
Watching for changes
npm run watch
Architecture
The extension consists of:
- Client (
src/extension.ts): VS Code extension activation and client setup - Language Server: Provided by
ncc lsp(external to this extension) - Grammar (
syntaxes/nc.tmLanguage.json): TextMate grammar for syntax highlighting - Configuration (
language-configuration.json): Language-specific editor behavior
The language server is provided by the NC compiler itself via the ncc lsp command, ensuring the language support is always in sync with the compiler