Skip to content

Correctly detect file-local NoUnicodeSyntax - #5078

Merged
Aster89 merged 3 commits into
haskell:masterfrom
Aster89:master
Sep 9, 2026
Merged

Correctly detect file-local NoUnicodeSyntax#5078
Aster89 merged 3 commits into
haskell:masterfrom
Aster89:master

Conversation

@Aster89

@Aster89 Aster89 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

This change contains:

  1. a relatively small edit to take into account possible {-# LANGUAGE UnicodeSyntax #-}/{-# LANGUAGE NoUnicodeSyntax #-} in the file being edited, and to treat those with higher priority than the corresponding flags in (corresponding stanza in) the .cabal file,

  2. a test that looks a bit ugly right now;

Regarding 2, my intent is to test for the 9 combinations of {-# LANGUAGE UnicodeSyntax #-}/{-# LANGUAGE NoUnicodeSyntax #-}/neither × corresponding 3 alternatives in the .cabal file, and I've tried, but the code looks messy…

Suggestions?

Fix #5067.

@Aster89
Aster89 requested a review from fendor as a code owner September 7, 2026 15:48
@Aster89 Aster89 self-assigned this Sep 7, 2026
@Aster89
Aster89 requested a review from MangoIV September 8, 2026 05:45

@fendor fendor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one nitpick and a suggestion that I am fine to do in a follow-up

Comment thread plugins/hls-case-split-plugin/src/Ide/Plugin/CaseSplit.hs Outdated
Comment on lines +164 to +178
$ let cabalFile = [
"cabal-version: 3.4",
"name: foo",
"version: 0.1.0.0",
"build-type: Simple",
"common warnings",
" ghc-options: -Wall",
"library",
" import: warnings",
" exposed-modules: TUnicodeArrow",
" build-depends: base",
" hs-source-dirs: .",
" default-language: GHC2024"
]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have honestly been far easier to write a direct cradle test like this:

cradle:
  direct:
    arguments:
    - Module
    - -XGHC2024

Since you care about the base arguments to GHC, rather than that it is a cabal project.

We can merge as is, create an issue to convert it to a direct cradle test.
Direct cradle tests are much faster since we don't need to load the cabal context.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll create an issue for that.

To understand a bit more, do you mean that I would write

      $ let cradleFile = [
              "cradle:",
              "  direct:",
              "    arguments:",
              "    - Module",
              "    - -XGHC2024",
              ]

and, similarly to what I've done, I'd add another line to mean "add UnicodeSyntax" / "add NoUnicodeSyntax"?

@Aster89
Aster89 enabled auto-merge (squash) September 9, 2026 09:59
@Aster89
Aster89 merged commit 856cab0 into haskell:master Sep 9, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants