azdavis / millet

A language server for Standard ML.
https://azdavis.net/posts/millet
Apache License 2.0
197 stars 12 forks source link

Integrate with SML/NJ #19

Open azdavis opened 1 year ago

azdavis commented 1 year ago

Problem

No integration with SML/NJ currently. Have to go to the terminal and manually run it every time.

Solution

the baseline would be that i can have a window with the smlnj interactive system, and be able to send either a whole buffer from a millet window, or a selected segment. ideally i could also go back from the interactive window by clicking on error messages.

(from Bob Harper on the Project Savanna Discord)

azdavis commented 1 year ago

This is a bit non trivial especially with larger projects. For instance, if i have a project with a mlb file

a.sml
b.sml
c.sml

and my cursor is in the middle of b.sml, and I request SML/NJ output, we should be clever enough to feed SML/NJ only a.sml and part of b.sml, up to the current cursor.

Feeding the interpreter only part of a file is also a bit tricky, since what if the file starts with e.g. a structure Foo = struct ... that goes until the end of the file? How should invoking SML/NJ when the cursor is between the struct and matching end work?