|
1 | 1 | # Standalone JSON client for `ide-backend`
|
2 | 2 |
|
3 |
| -This executable binds against the `ide-backend` library and makes it API available over JSON. It is intended to faciliate integration of `ide-backend` in editors such Atom, Emacs, Sublime, Vim, etc. |
| 3 | +This executable binds against the `ide-backend` library and makes it API |
| 4 | +available over JSON. It is intended to faciliate integration of `ide-backend` in |
| 5 | +editors such Atom, Emacs, Sublime, Vim, etc. This repository contains an emacs |
| 6 | +integration called `stack-mode`. |
4 | 7 |
|
5 |
| -# Installation instructions |
6 |
| - |
7 |
| -Make sure to compile `ide-backend-client` against the same version of the `Cabal` library that your `cabal-install` uses. For instance, you could add a file `cabal.config`: |
8 |
| - |
9 |
| -``` |
10 |
| -constraints: Cabal==1.22.0.0 |
11 |
| -``` |
12 |
| - |
13 |
| -# Example interaction: |
14 |
| - |
15 |
| -``` javascript |
16 |
| -// ide-backend-client sends welcome message and provides its version |
17 |
| -{ "response": "welcome" |
18 |
| -, "version": { "minor": 1, "major": 0, "patch": 0 } |
19 |
| -} |
20 |
| - |
21 |
| -// editor requests to load a source file |
22 |
| -> { "request": "updateSession" |
23 |
| -> , "update": [ |
24 |
| -> { "update": "updateSourceFileFromFile" |
25 |
| -> , "filePath": "t/A.hs" |
26 |
| -> } |
27 |
| -> ] |
28 |
| -> } |
29 |
| - |
30 |
| -// client responds with progress message |
31 |
| -< { "progress": { |
32 |
| -< "origMsg": "[1 of 1] Compiling A ( /path/to/t/A.hs, interpreted )", |
33 |
| -< "parsedMsg": "Compiling A", |
34 |
| -< "numSteps": 1, |
35 |
| -< "step": 1 |
36 |
| -< } |
37 |
| -< , "response": "sessionUpdate" |
38 |
| -< } |
| 8 | +# Project Status |
39 | 9 |
|
40 |
| -// After the last progress message where will be one more response |
41 |
| -< { "response": "sessionUpdate" } |
| 10 | +stack-ide is still a work-in-progress. The goal is to create an environment for |
| 11 | +seamlessly getting lots of info about our Haskell code, but it isn't perfect |
| 12 | +yet. Give it a try, and feel free to join in on development! |
42 | 13 |
|
43 |
| -// Editor requests the list of errors |
44 |
| -> { "request": "getSourceErrors" } |
45 |
| - |
46 |
| -// client responds with the empty list |
47 |
| -< { "response": "getSourceErrors" |
48 |
| -< , "errors": [] |
49 |
| -< } |
50 |
| - |
51 |
| -// editor requests information about an identifier at a specific location |
52 |
| -> { "request": "getSpanInfo" |
53 |
| -> , "module": "A" |
54 |
| -> , "span": { |
55 |
| -> "filePath": "t/A.hs" |
56 |
| -> , "fromLine": 3 |
57 |
| -> , "fromColumn": 2 |
58 |
| -> , "toLine": 3 |
59 |
| -> , "toColumn": 2 |
60 |
| -> } |
61 |
| -> } |
62 |
| - |
63 |
| -// client responds with the information |
64 |
| -< { |
65 |
| -< "response": "getSpanInfo", |
66 |
| -< "info": [ |
67 |
| -< { |
68 |
| -< "span": { |
69 |
| -< "toColumn": 4, |
70 |
| -< "fromLine": 3, |
71 |
| -< "filePath": "t/A.hs", |
72 |
| -< "toLine": 3, |
73 |
| -< "fromColumn": 1 |
74 |
| -< }, |
75 |
| -< "isQuasiQuote": false, |
76 |
| -< "idInfo": { |
77 |
| -< "scope": { |
78 |
| -< "scope": "local" |
79 |
| -< }, |
80 |
| -< "prop": { |
81 |
| -< "nameSpace": "varName", |
82 |
| -< "name": "foo", |
83 |
| -< "type": "Int", |
84 |
| -< "defSpan": { |
85 |
| -< "toColumn": 4, |
86 |
| -< "fromLine": 4, |
87 |
| -< "filePath": "t/A.hs", |
88 |
| -< "toLine": 4, |
89 |
| -< "fromColumn": 1 |
90 |
| -< }, |
91 |
| -< "definedIn": { |
92 |
| -< "name": "A", |
93 |
| -< "package": { |
94 |
| -< "packageKey": "main", |
95 |
| -< "name": "main" |
96 |
| -< } |
97 |
| -< } |
98 |
| -< } |
99 |
| -< } |
100 |
| -< } |
101 |
| -< ] |
102 |
| -< } |
103 |
| - |
104 |
| -// editor asks for the type of an expression at a particular location |
105 |
| -> { "request": "getExpTypes" |
106 |
| -> , "module": "A" |
107 |
| -> , "span": { |
108 |
| -> "filePath": "t/A.hs" |
109 |
| -> , "fromLine": 4 |
110 |
| -> , "fromColumn": 7 |
111 |
| -> , "toLine": 4 |
112 |
| -> , "toColumn": 7 |
113 |
| -> } |
114 |
| -> } |
115 |
| - |
116 |
| -// client responds |
117 |
| -< { |
118 |
| -< "response": "getExpTypes", |
119 |
| -< "info":[ |
120 |
| -< { |
121 |
| -< "span": { |
122 |
| -< "toColumn": 8, |
123 |
| -< "fromLine": 4, |
124 |
| -< "filePath": "t/A.hs", |
125 |
| -< "toLine": 4, |
126 |
| -< "fromColumn": 7 |
127 |
| -< }, |
128 |
| -< "type": "Int" |
129 |
| -< } |
130 |
| -< ] |
131 |
| -< } |
132 |
| - |
133 |
| -// editor requests shutdown |
134 |
| -> { "request": "shutdownSession" } |
| 14 | +# Installation instructions |
135 | 15 |
|
136 |
| -// client shuts down |
137 |
| -< { "response":"shutdownSession" } |
| 16 | +Run `stack install` to locally install `ide-backend` and `stack-ide`. |
0 commit comments