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

Build #25

Merged
merged 32 commits into from
Aug 14, 2015
Merged

Build #25

merged 32 commits into from
Aug 14, 2015

Conversation

texastoland
Copy link
Contributor

This is the big one. I'll just list features:

  1. Two standard build commands triggered with Super+[Shift]+B or Super+[Shift]+F7.
    • The first just check errors. Credit to @rtfeldman's tweet!
    • Run additionally builds output to an intelligent path.
  2. Errors are formatted for small space. They're navigable with Super+[Shift]+F4. Error highlighting is integrated with Highlight Build Errors (ST3 only) plugin if installed.
  3. Compile messages are both highlighted and colored including embedded source 🎨
  4. Ouput paths are configurable in elm-package.json. Keys not documented? No fear! There's a UI labeled Elm Build System in the Command Palette. It only requires a valid config in any ancestor directory of the edited file.
  5. Launch generated HTML in your browser from an Elm source file. It requires SideBarEnhancements (ST3 only) if installed or alternatively View In Browser plugin. Not building HTML? That path is configurable in the Command Palete too.
  6. Fully ST2/ST3 compatible.

Intercept and reformat compiler errors by subclassing ExecCommand
Proxy to external plugin if installed otherwise inform user
Mirror sublime.expand_variables syntax. But sublime functions would make code less clear here. Revisit for ST2 compatibility
Read and write build settings with intelligent defaults
Enable custom builds instead of compiling without output. Fix empty compile on Windows
@rtfeldman
Copy link
Contributor

Tried it out, got this in the console:

Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-lang/core 2.1.0

Do you approve of this plan? (y/n) elm-make: <stdin>: hGetLine: end of file
[Finished in 1.0s with exit code 1]
[shell_cmd: elm-make]
[dir: /Users/rtfeldman/code/elm-core/src]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

I've seen the hGetLine: end of file error before (it's a Haskell thing), and we've worked around it by setting the LANG env var. I tried doing that in the build config...

{
  "env": {
    "LANG": "en_US.UTF-8"
  },
  "shell_cmd": "elm-make"
}

...but this time it didn't help.

Anyway, the error was happening because the file I was editing (Maybe.elm in core) happened to be in the src/ directory instead of the project root. elm-make needs to run in whatever directory elm-package.json lives in, so I hacked around it by doing this:

{
  "working_dir": "../",
  "shell_cmd": "elm-make"
}

...although naturally that's not a scalable solution. 😄

@rtfeldman
Copy link
Contributor

At that point the build ran and I saw the output in the console, which was pretty sweet!

I have Highlight Build Errors installed, but didn't see any inline. (I also tried uninstalling/reinstalling Highlight Build Errors, uninstalling/reinstalling elm-sublime, and restarting Sublime Text 3, but still no highlighting.)

Awesome progress @dnalot! 😃

@rtfeldman
Copy link
Contributor

Same deal with SublimeREPL: I have it installed, but don't see Elm integrations.

screen shot 2015-08-03 at 9 04 30 pm

@rtfeldman
Copy link
Contributor

Also, for reference, this is the version I had installed:

screen shot 2015-08-03 at 9 06 04 pm

@texastoland
Copy link
Contributor Author

Mind reporting each in my fork?

  1. Re. src folder: Looking now!
  2. Re. Highlighting: do F4/Shift+F4 select your errors in the build panel?
  3. Re. REPL: do you see anything Elm or REPL related in the Console (Ctrl+`), especially at startup?

@texastoland
Copy link
Contributor Author

Status:

  1. I couldn't repro the hGetLine issue. I'm supposed to be passing the --yes flag? I meant to account for it if you can raise the issue.
  2. Looks like an issue with elm-make prepending JSON with a message. I have a solution for that. Reported upstream --report=json doesn't return JSON elm-lang/elm-make#38. Issue in mine wouldn't hurt.
  3. Thanks for making dnalot/elm-sublime#1. I think it's an initialization order thing. I'd seen it intermittently but your log clarified it.

Integrate SideBarEnhancements for ST3 for poplarity and browser detection
Also appears in Tools menu
Load external dependencies lazily. Flip of the coin whether they error otherwise
Fix import for execCommand. Lazily load Highlight Build Errors c.f. previous commit
Parse plain string lines interspersed with JSON from elm-make
@deadfoxygrandpa
Copy link
Owner

I just remembered this, and so I don't forget it I'll write it down. the --output /dev/null trick doesn't work on Windows, but I just tried --output NUL and that seems to work, so we should probably do it that way on Windows.

@texastoland
Copy link
Contributor Author

I already did it. Don't merge yet though! I just rebased.

@texastoland
Copy link
Contributor Author

@rtfeldman All issues should be fixed 🙏

...because I over-engineered it
@vilterp
Copy link

vilterp commented Aug 6, 2015

Is it possible to hyperlink from errors in the console to the code?

@rtfeldman
Copy link
Contributor

That would be very nice, if possible!

On Thu, Aug 6, 2015, 12:05 PM Pete Vilter notifications@github.com wrote:

Is it possible to hyperlink from errors in the console to the code?


Reply to this email directly or view it on GitHub
#25 (comment)
.

@texastoland
Copy link
Contributor Author

Yes but I'm still evaluating how to do it with the least amount of code. Basically it's completely custom navigation. Report it in either repo and I'll tag it as a feature!

@vilterp
Copy link

vilterp commented Aug 6, 2015

Reported in your fork (issue 3)

- Conventional property naming
- Fix ST2/3 incompatibility
- Log decoded elm-package.json
Also simplify common imports
Because this took hours to diagnose myself
Maintain key order in elm-package.json for diffs and log JSON key paths
Beware: MRO currently broken for patched methods
Build system file_regex only navigate single lines. In the future we could provide an enhanced double click handler
@texastoland
Copy link
Contributor Author

@deadfoxygrandpa This one's ready to merge. I'll open a separate PR for a ST3 error in existing code. Also looking into #28 if you can take #29?

deadfoxygrandpa added a commit that referenced this pull request Aug 14, 2015
@deadfoxygrandpa deadfoxygrandpa merged commit 2f325f3 into deadfoxygrandpa:develop Aug 14, 2015
@deadfoxygrandpa
Copy link
Owner

OK, I'll merge it in. Thanks a lot for all this work.

@texastoland texastoland deleted the build branch August 17, 2015 17:16
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.

4 participants