typefox / langium-sql Goto Github PK
View Code? Open in Web Editor NEWLanguage server for SQL in Langium
License: MIT License
Language server for SQL in Langium
License: MIT License
Requirements:
Good for:
They are currently not displayable.
A cast is called like this: CAST (value AS targetType)
and convert a value into another type.
Casts are orthogonal to the type system: There are cast rules for each data type (cast is allowed/not allowed, what is the outcome).
Here is the documentation for all data types:
Split this task as desired.
when i compile this project, i get error mssages as blow:
src/sql-scope-provider.ts:131:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
131 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:140:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
140 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:149:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
149 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:166:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
166 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:177:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
177 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:210:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
210 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:220:39 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'never'.
220 assertUnreachable(property);
~~~~~~~~
src/sql-scope-provider.ts:231:31 - error TS2345: Argument of type 'ColumnDefinition | ExpressionQuery | NumberLiteral | StringLiteral | CatalogDefinition | ... 45 more ... | TopClause' is not assignable to parameter of type 'never'.
Type 'ColumnDefinition' is not assignable to type 'never'.
231 assertUnreachable(container);
my environment :
node: v18.20.1
typescript: v5.4.4
What can i do to fix it ?
I'm not sure the SimpleSelectStatement.select and PrimaryExpression.FunctionCall rules are correct.
I'm assuming FunctionCall
is intended to parse system function calls (E.g. ABS() or DATEADD(), etc)
Problems:
SelectElements
rule for its params property;{infer FunctionCall} function=GlobalReference '(' params=SelectElements? ')'
overClause=OverClause?
SelectElements:
('ALL'|distinct?='DISTINCT')? elements+=SelectElement (',' elements+=SelectElement)*
;
SelectElement infers SelectElement:
{infer AllStar} '*'
| {infer AllTable} variableName=[TableVariableSource:Identifier] '.' '*'
| {infer ExpressionQuery} expr=Expression ('AS'? name=Identifier)?
;
Happy to propose a fix if I've understood this correctly.
Check the chapters 3 to 13 from the Standard:
Example:
SELECT CASE
WHEN team_name = 'Blue Bombers' THEN city
ELSE '*********'
END AS city
FROM Teams;
There are several type categories. With this issue, we will implement a basic type system that understands
Each type has operators, casts to other types, assignment behaviors and functions that can be called.
Hi @Lotes,
Thanks for your part in creating this project - I'm considering including it in a project I work on - the current feature set is already very compelling.
I'm keen to add sql-server dialect support and thought it best to raise it here first in case contributing such a feature to this project is possible/preferable. I've been able to easily support sql-server's data types, but it seems syntax specific features (e.g square bracket for quoting keywords/spaces in table/column names) will require a separate / extended parser.
I've not tried the langium lib itself yet but have some experience building editor plugins using antlr4. Any pointers would be much appreciated.
SELECT
arguments*
t.*
FROM
argumentsWHERE
conditionsGROUP BY
clauseORDER BY
clauseHAVING
clauseLIMIT
clauseA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.