Comments (6)
interesting cases:
foo:
SELECT *
FROM foo
foo:
SELECT *
FROM foo
LEFT JOIN bar
foo:
SELECT *
FROM foo
from sqldelight.
I think the only reasonable policy here is to discourage indentation on lines following a name and preserve it on every line of the query.
So the above examples change to:
foo:
SELECT *
FROM foo
foo:
SELECT *
FROM foo
LEFT JOIN bar
foo:
SELECT *
FROM foo
from sqldelight.
and we can use syntax highlighting to visually distinguish label names from query syntax
from sqldelight.
actually preserving the spaces in front of the first SELECT is tricky. Both the gradle plugin and intellij just copy the text from start index to stop index. Ideally theres a way to grab text via line numbers. I'll see how far I can get with that. It's actually all the lines EXCEPT the first are indented properly.
Pretty related to what you've been mentioning is #1 . Once we decide on how to format the queries, how does the formatter come into play? More specifically, what happens if I have SELECT *
and then hit enter. Does the cursor go right below the T
, or does it go to the beginning of the new line?
I agree with the formatting you're suggesting though, where the longest keyword is fully left aligned and then everything else is right aligned with the longest keyword. As for the formatter easiest and most user friendly is probably just to do nothing while they're typing and then align things when they actually run the formatter.
Also, wouldn't the last case format to the same as the first case?
from sqldelight.
If you applied formatting on the whole file then yes they should end up the same. For this issue I was only thinking about how the indentation was copied to the source's string literal in those two cases.
from sqldelight.
Recommendation is: left-align your things in some way.
SELECT *
FROM table
WHERE things
or when it gets big:
SELECT
column,
another,
more
FROM
table,
chair,
desk
WHERE
things AND
more things AND
all the things
GROUP BY
everything
from sqldelight.
Related Issues (20)
- It fails to compile the interface for query that contains `levenshtein` function HOT 2
- How to complete migration in Compose Desktop HOT 3
- Support for `contentless_delete` option in FTS5
- java.lang.IllegalStateException in SqldelightParserUtil.kt:195
- java.lang.IllegalStateException in SqlDelightParserDefinition.kt:37
- Android driver support for `generateAsync`
- PostgreSql Dialect add USING BRIN/GIST to CREATE INDEX statement
- java.util.NoSuchElementException in UpsertClauseMixin.kt:47
- java.lang.Throwable in ProjectService.kt:215
- java.io.IOException in GeneratedVirtualFile.kt:54
- java.lang.Throwable in SqlDelightFindUsagesHandlerFactory.kt:37
- IntelliJ plugin breaks find usages on 2024.1 EAP HOT 4
- mysql INET_ATON/INET_NTOA support HOT 5
- The IFNULL function and COALESCE cause a compilation exception.
- java.lang.IllegalStateException in SqliteParserUtil.kt:70
- Expose database in AndroidSqliteDriver
- java.lang.NullPointerException (no error message) HOT 1
- Add PostgreSql TSVector Column type
- Hundreds of Recompositions Despite No Changes HOT 4
- Add support for pg RIGHT/FULL [OUTER] JOIN HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqldelight.