Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scheme racket #22

Merged
merged 5 commits into from
Jul 3, 2013
Merged

Conversation

tlehman
Copy link
Contributor

@tlehman tlehman commented Jul 1, 2013

Add Scheme (Racket) support

Note: Still need to handle empty lines, Scheme interpreters pause on empty lines.

@jcartledge
Copy link
Owner

This is cool - thanks! Not sure how to handle the empty lines - do you have any ideas?

@tlehman
Copy link
Contributor Author

tlehman commented Jul 2, 2013

We could intercept the empty lines before they get passed to the interpreter, letting it be a no-op. I haven't delved into the python code very deeply, I will implement this and push it up.

@jcartledge
Copy link
Owner

Check how PHP is configured - it ignores lines with '' (i.e. doesn't send them to the interpreter) because the interpreter chokes on them, but we need them in the editor for syntax to work.

I haven't tried it, but it might be as simple as adding:

"ignore": ["^$"]

to the racket config.

@tlehman
Copy link
Contributor Author

tlehman commented Jul 2, 2013

@jcartledge That worked! I noticed that it doesn't insert the results as comments, I assume that is what the prefix key is right?

@jcartledge
Copy link
Owner

OK, I finally got a bit of time to look at this.
Here's what works for me:

    "Racket": {
        "cmd": "guile",
        "prompt": ["guile>"],
        "prefix": ";; > ",
        "error": ["ERROR:"],
        "ignore": ["^[\\s]*\n", "^[\\s]*;;"]
    }
  • prompt, error and ignore need to be arrays of strings, even if there is only one value.
  • I've added an angle bracket to prefix. It needs something to distinguish it from a regular comment because it's used in the Clear previous results command to match lines. If it's not distinguished all comments will get deleted.
  • The interpreter hangs on lines beginning with a comment as well as empty lines. I guess it throws the comment away and then the line is empty? Lines which only contain whitespace are a problem as well, so I updated the regex to catch them.

Can you please:

  • Check that works at your end, and update your branch to the working version,
  • Ensure the languages under "worksheet_languages" are sorted alphabetically (so Racket comes before Ruby - it's anal, I know,) and
  • Rebase against master - it's changed slightly since the original pull request.

Then we should be good to go! Thanks for making the effort - I really appreciate it.

@tlehman
Copy link
Contributor Author

tlehman commented Jul 2, 2013

I verified that it works on my end, sorted the list of languages and then rebased off your new master branch, we should be good to merge.

Working on this is my pleasure, this is just the kind of functionality I've been missing in ST2 that Emacs had going for it. I like the sublime-worksheet approach more though, since it is much easier to work with than Lisp.

@jcartledge jcartledge mentioned this pull request Jul 2, 2013
jcartledge added a commit that referenced this pull request Jul 3, 2013
@jcartledge jcartledge merged commit 2bda218 into jcartledge:master Jul 3, 2013
@jcartledge
Copy link
Owner

This is in master and will be in the next release going out in a day or so.

@tlehman
Copy link
Contributor Author

tlehman commented Jul 3, 2013

@jcartledge Will that release be available to the ST2 package manager?

@tlehman tlehman deleted the add-scheme-racket branch July 3, 2013 17:38
@jcartledge
Copy link
Owner

Yes it will.

@tlehman
Copy link
Contributor Author

tlehman commented Jul 3, 2013

Awesome

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