-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
area:ecosystemCross-repo initiatives and ecosystem-wide featuresCross-repo initiatives and ecosystem-wide featuresarea:vscodeVSCode extension (syntax, commands, snippets)VSCode extension (syntax, commands, snippets)help wantedExtra attention is neededExtra attention is neededtype:featureNew feature or functionalityNew feature or functionality
Description
Goal
Create a Sublime Text package for LUMOS with syntax highlighting and LSP integration.
Phase: 5.2 IDE Integration
Depends On: #45 (LSP implementation)
Problem
Sublime Text users have no LUMOS support:
- ❌ No syntax highlighting
- ❌ No auto-completion
- ❌ No diagnostics
- ❌ Files treated as plain text
Solution
Create Sublime Text package with:
- Syntax definition (syntax highlighting)
- LSP-lumos configuration (IDE features via LSP)
Implementation
Package Structure
LUMOS/
├── LUMOS.sublime-syntax # Syntax highlighting
├── LUMOS.sublime-settings # Settings
├── LSP-lumos.sublime-settings # LSP configuration
├── Comments.tmPreferences # Comment shortcuts
├── Indentation.tmPreferences # Auto-indent rules
└── README.md
Syntax Definition
File: LUMOS.sublime-syntax
%YAML 1.2
---
name: LUMOS
file_extensions: [lumos]
scope: source.lumos
contexts:
main:
- include: comments
- include: attributes
- include: keywords
- include: types
- include: strings
comments:
- match: //
scope: punctuation.definition.comment.lumos
push:
- meta_scope: comment.line.double-slash.lumos
- match: $\n?
pop: true
- match: /\*
scope: punctuation.definition.comment.begin.lumos
push:
- meta_scope: comment.block.lumos
- match: \*/
scope: punctuation.definition.comment.end.lumos
pop: true
attributes:
- match: '#\['
scope: punctuation.definition.attribute.begin.lumos
push:
- meta_scope: meta.attribute.lumos
- match: '\]'
scope: punctuation.definition.attribute.end.lumos
pop: true
- match: '\b(solana|account|version|deprecated)\b'
scope: entity.name.attribute.lumos
- match: '='
scope: keyword.operator.assignment.lumos
- include: strings
keywords:
- match: '\b(struct|enum|pub)\b'
scope: keyword.declaration.lumos
types:
- match: '\b(u8|u16|u32|u64|u128|i8|i16|i32|i64|i128|bool|String)\b'
scope: storage.type.primitive.lumos
- match: '\b(PublicKey|Signature)\b'
scope: storage.type.solana.lumos
- match: '\b(Vec|Option)\b'
scope: storage.type.generic.lumos
- match: '\b([A-Z][a-zA-Z0-9_]*)\b'
scope: entity.name.type.lumos
strings:
- match: '"'
scope: punctuation.definition.string.begin.lumos
push:
- meta_scope: string.quoted.double.lumos
- match: '"'
scope: punctuation.definition.string.end.lumos
pop: true
- match: '\\.'
scope: constant.character.escape.lumosLSP Configuration
File: LSP-lumos.sublime-settings
{
"clients": {
"lumos": {
"enabled": true,
"command": ["lumos-lsp"],
"selector": "source.lumos",
"initializationOptions": {},
"settings": {}
}
}
}Package Settings
File: LUMOS.sublime-settings
{
"extensions": ["lumos"],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}Comment Preferences
File: Comments.tmPreferences
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.lumos</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>// </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
</dict>
</plist>Installation
Via Package Control
- Install LSP package first
Cmd/Ctrl + Shift + P→ "Package Control: Install Package"- Search for "LUMOS"
- Install
Manual Installation
# Clone into Sublime Text packages directory
cd ~/Library/Application\ Support/Sublime\ Text/Packages # macOS
cd ~/.config/sublime-text/Packages # Linux
cd %APPDATA%\Sublime Text\Packages # Windows
git clone https://github.com/getlumos/sublime-lumos LUMOSLSP Server Setup
Install LUMOS LSP server:
cargo install lumos-lspEnable LSP in Sublime Text:
Preferences → Package Settings → LSP → Settings- Ensure
lumos-lspis in PATH
Features
Syntax Highlighting
- Keywords:
struct,enum,pub - Types: Primitives, Solana types, generics
- Attributes:
#[solana],#[account] - Comments: Line and block
- Strings: With escape sequences
LSP Integration
- Auto-completion (
Ctrl+Space) - Diagnostics (inline errors)
- Go to definition (
F12) - Hover info (
Ctrl+K, Ctrl+I) - Find references (
Shift+F12) - Rename symbol (
F2)
Editor Features
- Auto-indent
- Comment toggling (
Cmd/Ctrl+/) - Bracket matching
- Code folding
Testing
Manual Testing
- Open Sublime Text
- Create
test.lumos - Enter:
#[solana] struct Player { wallet: PublicKey, level: u16, } - Verify:
- Syntax highlighting
- Auto-completion works
- Errors show inline
-
Cmd+/comments/uncomments
Automated Testing
Use UnitTesting package:
File: tests/test_syntax.py
import sublime
from unittesting import DeferrableTestCase
class TestLumosSyntax(DeferrableTestCase):
def test_file_extension(self):
view = self.view
view.assign_syntax('LUMOS.sublime-syntax')
self.assertEqual(view.syntax().name, 'LUMOS')
def test_keyword_highlighting(self):
view = self.view
view.run_command('insert', {'characters': 'struct Player {}'})
# Verify 'struct' has keyword scope
scope = view.scope_name(0)
self.assertIn('keyword.declaration.lumos', scope)Publishing
Submit to Package Control
- Fork packagecontrol.io
- Add repository to
repository/l.json:
{
"name": "LUMOS",
"details": "https://github.com/getlumos/sublime-lumos",
"releases": [
{
"sublime_text": ">=3211",
"platforms": ["*"],
"tags": true
}
]
}- Create PR
Success Criteria
- Syntax highlighting works for all LUMOS syntax
- LSP integration provides auto-completion
- Diagnostics show errors inline
- Comment toggling works (
Cmd+/) - Auto-indent functional
- Package installable via Package Control
- Works on macOS, Linux, Windows
- Tests passing
- Documentation complete
Documentation
Create New Files
-
sublime-lumos/README.md- Package documentation -
docs/editors/sublime.md- Sublime Text setup guide
Update Files
-
README.md- Add Sublime installation instructions -
CHANGELOG.md- Document package release -
ROADMAP.md- Mark Phase 5.2 item as complete ✅
Related
- Depends on: Implement Language Server Protocol (LSP) for LUMOS #45 (LSP server)
- ROADMAP.md Phase 5.2 - IDE Integration
Priority: Low
Complexity: Low-Medium
Timeline: 3-4 days
Depends On: #45
📌 Remember: Update ROADMAP.md after completing this issue!
Metadata
Metadata
Assignees
Labels
area:ecosystemCross-repo initiatives and ecosystem-wide featuresCross-repo initiatives and ecosystem-wide featuresarea:vscodeVSCode extension (syntax, commands, snippets)VSCode extension (syntax, commands, snippets)help wantedExtra attention is neededExtra attention is neededtype:featureNew feature or functionalityNew feature or functionality