https://github.com/fgeller/scalariform-daemon
Trigger formatting of files via HTTP requests.
https://github.com/fgeller/scalariform-daemon
Last synced: about 1 year ago
JSON representation
Trigger formatting of files via HTTP requests.
- Host: GitHub
- URL: https://github.com/fgeller/scalariform-daemon
- Owner: fgeller
- Created: 2013-06-03T10:02:19.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2015-09-04T06:32:10.000Z (almost 11 years ago)
- Last Synced: 2023-03-12T04:48:25.847Z (over 3 years ago)
- Language: Scala
- Homepage:
- Size: 153 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# scalariform-daemon
Trigger formatting of files via HTTP requests.
### Build
sbt assembly
### Run
java -jar ./target/scala-2.11/scalariform-daemon.jar
or
sbt run
### Use
Make an HTTP request against localhost and provide the `fileName` and `preferencesFile` parameters like:
http://127.0.0.1:5474/format?fileName=/path/to/your/file&preferencesFile=/path/to/your/preferences/file
For example, in my Emacs config I have the following call added to
`before-save-hook` in Scala buffers, where `scalariform-preferences-file` is a
[directory local variable](http://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html)
I set in my Scala projects:
(defun scalariform-daemon-format-file ()
(when (and (boundp 'scalariform-preferences-file) scalariform-preferences-file)
(request
"http://127.0.0.1:5474/format"
:params `((fileName . ,buffer-file-name)
(preferencesFile . ,scalariform-preferences-file))
:sync t)
(revert-buffer t t)))