|
| 1 | +# GoSQLX - SQL Parser & Linter for VS Code |
| 2 | + |
| 3 | +High-performance SQL parsing, validation, formatting, and analysis powered by [GoSQLX](https://github.com/ajitpratap0/GoSQLX). |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### Real-time SQL Validation |
| 8 | +Get instant feedback on SQL syntax errors as you type. Errors are highlighted directly in the editor with detailed messages. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +### SQL Formatting |
| 13 | +Format your SQL code with customizable indentation and keyword casing. |
| 14 | + |
| 15 | +- **Keyboard shortcut**: `Ctrl+Shift+F` (Windows/Linux) or `Cmd+Shift+F` (Mac) |
| 16 | +- **Command palette**: "GoSQLX: Format SQL" |
| 17 | +- **Right-click menu**: Format SQL |
| 18 | + |
| 19 | +### Intelligent Autocomplete |
| 20 | +Get context-aware suggestions for: |
| 21 | +- SQL keywords (100+ supported) |
| 22 | +- SQL functions with signatures |
| 23 | +- Common SQL snippets and patterns |
| 24 | + |
| 25 | +### Hover Documentation |
| 26 | +Hover over SQL keywords to see documentation and usage examples. |
| 27 | + |
| 28 | +### SQL Analysis |
| 29 | +Analyze query complexity, find potential issues, and get optimization suggestions. |
| 30 | + |
| 31 | +## Supported SQL Dialects |
| 32 | + |
| 33 | +- PostgreSQL |
| 34 | +- MySQL |
| 35 | +- SQL Server |
| 36 | +- Oracle |
| 37 | +- SQLite |
| 38 | +- Generic SQL |
| 39 | + |
| 40 | +## Requirements |
| 41 | + |
| 42 | +You need to have the `gosqlx` CLI tool installed: |
| 43 | + |
| 44 | +```bash |
| 45 | +# Install via Go |
| 46 | +go install github.com/ajitpratap0/GoSQLX/cmd/gosqlx@latest |
| 47 | + |
| 48 | +# Verify installation |
| 49 | +gosqlx --version |
| 50 | +``` |
| 51 | + |
| 52 | +Make sure `gosqlx` is in your system PATH. |
| 53 | + |
| 54 | +## Extension Settings |
| 55 | + |
| 56 | +This extension contributes the following settings: |
| 57 | + |
| 58 | +| Setting | Default | Description | |
| 59 | +|---------|---------|-------------| |
| 60 | +| `gosqlx.enable` | `true` | Enable GoSQLX language server | |
| 61 | +| `gosqlx.executablePath` | `gosqlx` | Path to the gosqlx executable | |
| 62 | +| `gosqlx.trace.server` | `off` | Traces communication with the language server | |
| 63 | +| `gosqlx.format.indentSize` | `2` | Number of spaces for indentation | |
| 64 | +| `gosqlx.format.uppercaseKeywords` | `true` | Convert keywords to uppercase | |
| 65 | +| `gosqlx.validation.enable` | `true` | Enable real-time SQL validation | |
| 66 | +| `gosqlx.dialect` | `generic` | SQL dialect for validation | |
| 67 | + |
| 68 | +## Commands |
| 69 | + |
| 70 | +| Command | Description | |
| 71 | +|---------|-------------| |
| 72 | +| `GoSQLX: Validate SQL` | Validate the current SQL file | |
| 73 | +| `GoSQLX: Format SQL` | Format the current SQL file | |
| 74 | +| `GoSQLX: Analyze SQL` | Analyze query complexity and structure | |
| 75 | +| `GoSQLX: Restart Language Server` | Restart the GoSQLX language server | |
| 76 | +| `GoSQLX: Show Output Channel` | Show the GoSQLX output channel | |
| 77 | + |
| 78 | +## Performance |
| 79 | + |
| 80 | +GoSQLX delivers exceptional performance: |
| 81 | + |
| 82 | +| Operation | Speed | |
| 83 | +|-----------|-------| |
| 84 | +| Validation | 1.38M+ ops/sec | |
| 85 | +| Formatting | 2,600+ files/sec | |
| 86 | +| Parsing | 1.5M+ ops/sec | |
| 87 | + |
| 88 | +## Troubleshooting |
| 89 | + |
| 90 | +### Language server not starting |
| 91 | + |
| 92 | +1. Ensure `gosqlx` is installed and in your PATH: |
| 93 | + ```bash |
| 94 | + which gosqlx |
| 95 | + gosqlx --version |
| 96 | + ``` |
| 97 | + |
| 98 | +2. Check the GoSQLX output channel for errors: |
| 99 | + - Open Command Palette (`Ctrl+Shift+P`) |
| 100 | + - Run "GoSQLX: Show Output Channel" |
| 101 | + |
| 102 | +3. Try specifying the full path in settings: |
| 103 | + ```json |
| 104 | + { |
| 105 | + "gosqlx.executablePath": "/path/to/gosqlx" |
| 106 | + } |
| 107 | + ``` |
| 108 | + |
| 109 | +### Validation not working |
| 110 | + |
| 111 | +1. Ensure the file has a `.sql` extension |
| 112 | +2. Check that `gosqlx.validation.enable` is `true` |
| 113 | +3. Restart the language server |
| 114 | + |
| 115 | +## Contributing |
| 116 | + |
| 117 | +Contributions are welcome! Please see our [Contributing Guide](https://github.com/ajitpratap0/GoSQLX/blob/main/CONTRIBUTING.md). |
| 118 | + |
| 119 | +## License |
| 120 | + |
| 121 | +MIT License - see [LICENSE](https://github.com/ajitpratap0/GoSQLX/blob/main/LICENSE) |
| 122 | + |
| 123 | +## Release Notes |
| 124 | + |
| 125 | +### 0.1.0 |
| 126 | + |
| 127 | +Initial release: |
| 128 | +- Real-time SQL validation |
| 129 | +- SQL formatting with customizable options |
| 130 | +- Syntax highlighting for SQL |
| 131 | +- Intelligent autocomplete |
| 132 | +- Hover documentation |
| 133 | +- SQL analysis command |
| 134 | +- Multi-dialect support |
0 commit comments