flink-sql-language-server
Version:
A LSP-based language server for Apache Flink SQL
45 lines (35 loc) • 1.69 kB
Markdown
//img.shields.io/badge/flink%20version-1.20-blue)](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/)
[](https://www.npmjs.com/package/flink-sql-language-server)
[](https://www.npmjs.com/package/flink-sql-language-server)
A browser language server (LSP) for Apache Flink SQL, in addition to a simple vscode extension.
The language features are mainly implemented by [Antlr4ts](https://github.com/tunnelvisionlabs/antlr4ts).
## Functionality
This Language Server works for Flink SQL file. It has the following language features:
- Completions
- Diagnostics regenerated on each file change or configuration change
- Rename
- References
- FoldingRanges
- Hover
- DocumentFormatting
- CodeAction: QuickFix
- Custom Command
- extract SQL structure
- register schemas: auto-completion will include registered schemas
```typescript
import { EXTRACT_SQL_STRUCTURE } from 'flink-sql-language-server/out-tsc/constants';
// structure would be undefined if uri is invalid
const structure = await commands.executeCommand<StructureResult>(
EXTRACT_SQL_STRUCTURE,
window.activeTextEditor.document.uri.toString()
);
if (structure) {
// Do something
}
await commands.executeCommand<void>('extension.flinkSQL.registerSchemas', {
catalogs: [{ kind: 'catalog', label: 'testCatalog' }],
databases: [{ kind: 'database', catalog: 'testCatalog', label: 'testDatabase' }],
tables: [{ kind: 'table', catalog: 'testCatalog', database: 'testDatabase', label: 'testTable' }]
});
```
[![flink version](https: