Lighter-swift / Lighter

Swift APIs for SQLite: Type-safe down to the schema. Very, very, fast. Dependency free.
https://lighter-swift.github.io/documentation/lighter/
MIT License
459 stars 12 forks source link

Insufficient indentation of code generated by Enlighter #16

Closed fouquet closed 1 year ago

fouquet commented 2 years ago

I've got the issue that the create code generated by Enlighter does not properly indent the multi-line string literal and thus creates a compilation error:

Insufficient indentation of next 4 lines in multi-line string literal

Sample SQL:

CREATE TABLE IF NOT EXISTS "TestTable" (
  "id" integer PRIMARY KEY NOT NULL,
  "someText" text(128),
  "someInt" integer(128),
  "someFloat" real(128)
);

Code generated:

/// The SQL used to create the `TestTable` table.
    public static let create = 
      #"""
      CREATE TABLE "TestTable" (
  "id" INTEGER PRIMARY KEY NOT NULL,
  "someText" text(128),
  "someInt" integer(128),
  "someFloat" real(128)
);
      """#

Manually adding the generated code to the codebase and fixing the indentation compiles just fine.

Lighter: 1.0.16 Xcode 14.1

helje5 commented 2 years ago

Hm, that seems to work fine for me:

    /// The SQL used to create the `TestTable` table.
    public static let create = 
      #"""
      CREATE TABLE "TestTable" (
        "id" integer PRIMARY KEY NOT NULL,
        "someText" text(128),
        "someInt" integer(128),
        "someFloat" real(128)
      );
      """#

Maybe that happens on copy/paste in Xcode?

helje5 commented 2 years ago

Oh, is this the Swift Package Plugin or actually Enlighter the app?

fouquet commented 2 years ago

Oh sorry, forgot to mention - it's the plugin.

fouquet commented 1 year ago

BTW: I've bought the "Code for SQLite3" app, and guess what: it happens there too. No big deal in that case though because the file is only generated once.

Screen Shot 2022-11-29 at 14 47 06
helje5 commented 1 year ago

The strange thing is that it works for me 🤔

Screenshot 2022-11-29 at 14 52 13
fouquet commented 1 year ago

I've recently updated to Ventura. And guess what, it works fine now. Could this actually be a bug that only shows up on Monterey?

helje5 commented 1 year ago

Since I'm not on Ventura yet, that seems unlikely. Rather some option which doesn't transfer or sth

helje5 commented 1 year ago

I guess we can close this then :-)