Skip to content

Commit

Permalink
Update Makefile for vim integration
Browse files Browse the repository at this point in the history
* Updaet documentation
* Add missing error transformation script
* Make fix patht to transformation script
  • Loading branch information
Nicoretti authored and LMG committed Apr 30, 2021
1 parent 76f3e21 commit 5d1e8b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# this make file is just a small wrapper/helper to easily use this workspace within vim
#
# 1. Build workspace within vim and retrieve compile errors + warnings
# :make c
# 2. Format the code
# :make f

t: c

c:
cargo build --workspace --message-format=json | python3 ~/.bin/rerr.py
cargo build --workspace --message-format=json | python3 ./scripts/rerr.py

f:
cargo fmt
11 changes: 11 additions & 0 deletions scripts/rerr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
import sys
import json

for line in map(str.rstrip, sys.stdin):
m = json.loads(line)
try:
for s in m["message"]["spans"]:
print("{}:{}: {}".format(s["file_name"], s["line_start"], m["message"]["message"]))
except:
pass

0 comments on commit 5d1e8b5

Please sign in to comment.