Skip to content

cmake: install M2-language-server script#4453

Draft
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:lsp
Draft

cmake: install M2-language-server script#4453
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:lsp

Conversation

@d-torrance

Copy link
Copy Markdown
Member

I just installed M2 on my new MacBook and noticed that the language server script was missing!

The homebrew package uses the cmake build, and (as usual), I don't really understand cmake that well and didn't realize we needed an additional install() . I figured that just copying it to usr-dist like we do for the autotools build was sufficient. Nope!

AI Disclosure

Claude figured out what was missing and added the fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@mahrud mahrud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I hadn't seen the this script. Aside from cmake conventions, I don't think this script is the right way to go because it doesn't work if M2 isn't on the path or if you have multiple M2's on different paths, e.g. if I'm running M2 from a build directory I might not want the M2-language-server from brew to be used.

I would suggest one two options:

  1. move this script to the Macaulay2/bin directory and adjust it like the M2 script to run the correct M2-binary or just call ./M2 in the same directory, then move the install call to bin/CMakeFiles.txt and remove the COPY call.
  2. better yet, add this invocation as an argument to M2, e.g. startup.m2 should parse --LSP and just run this, with no extra files involved.

@d-torrance

d-torrance commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

Ooh, yeah, I like option 1. I'm hesitant about option 2. In particular, I foresee adding command-line options to M2-language-server soon and I'd rather not conflate them with M2's command-line options.

@d-torrance d-torrance marked this pull request as draft June 20, 2026 19:01
@mahrud

mahrud commented Jun 20, 2026

Copy link
Copy Markdown
Member

You could have a phase 0 check that if --LSP is present, option processing should stop and pass on to your script instead, similar to --silent which must be used like M2 --script blah.m2.

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.

2 participants