Skip to content

Conversation

@Frizlab
Copy link

@Frizlab Frizlab commented Jan 23, 2026

That being said:

  • I have no idea if it works before ST4 now;
  • I have not succeeded in running the tests (UnitTesting shows a panel at the bottom, but it is desperately empty; I suspect a syntax error, or something of that nature, but I don’t know for sure and am not sure how to debug…);
  • I have removed the support for vim modelines. There is a dedicated plugin for that if needed; let’s not mix everything up!
  • I migrated the EoL from dos to unix;
  • I removed things that I thought were useless; I hope they actually were!

@Frizlab
Copy link
Author

Frizlab commented Jan 23, 2026

Okay. The tests run now (I spent quite a lot of time discovering I had Modelines installed twice, somehow…). I have fixed the obvious syntax errors. Now the tests do not pass, but at least I have a working environment to fix the issues.

@Frizlab Frizlab marked this pull request as draft January 23, 2026 12:53
@Frizlab
Copy link
Author

Frizlab commented Jan 23, 2026

I also intend on completely changing the algorithm for detecting a modeline.
Currently we’re using the comment char that we request from the view, but I intend on using a static token-based recognition.

The rationale for that is we allow changing the syntax of the file, which means the comment char will probably incorrect if the syntax of the file is incorrect…

I think we could probably have the tokens like so (full-line regex):

.+~~\s*(st|sublime):.*~~[^~]*

(We assume here no comment will need to end with a ~ character.)

That would make any of these modelines recognized:

#~~st: x_syntax swift~~

# ~~st:x_syntax swift~~

// ~~sublime: x_syntax swift~~

↓ Syntax is `swift`, no trailing space. Keys and values are always trimmed. (Same for `value`, obviously.)
// ~~sublime: x_syntax swift ; key value ~~

↓ Preferred syntax.
/*~~ sublime: x_syntax swift ~~*/

And those would not be recognized:

↓ No `~~` at the end.
# ~~st:x_syntax swift ~

↓ Missing `~` before `st`.
# ~st: x_syntax swift ~~

↓ Space after `st`.
# ~~st : x_syntax swift ~~

What do you think?

EDIT: Syntax changes.

@michaelblyons
Copy link

michaelblyons commented Jan 23, 2026

You don't think \p{P}{1,4}\s*(st|sublime): is good enough?

@Frizlab
Copy link
Author

Frizlab commented Jan 23, 2026

It’s very edge-casy, but there is dnl.

@michaelblyons
Copy link

If you want to check ST3 compat, UnitTesting has a GH Action that can do it for you. There's probably not any divergence between platforms, so ST3, ST4 on Ubuntu is probably enough.

If you have CI minutes to burn. 😅

@Frizlab Frizlab changed the title Modernize repo and make sure it work with ST4 Modernize repo and make sure it works with ST4 Jan 24, 2026
@Frizlab
Copy link
Author

Frizlab commented Jan 24, 2026

Yes I noticed the UnitTesting repo has a GitHub Actions for testing in the CI and thought about setting that up.

Thanks for the review! I have not finalized everything yet, the PR is still a draft for now (I have to implement the format change, cleanup the tests even more, etc.) I will do the changes you proposed/requested before marking the PR ready.

@michaelblyons michaelblyons linked an issue Jan 24, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add to Package Control

4 participants