-
Notifications
You must be signed in to change notification settings - Fork 11
/
newbuildutility.txt
127 lines (107 loc) · 4.88 KB
/
newbuildutility.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
we could have a server listening to requests and always on (one server for all projects) Without the GHC API it shouldn't take much memory.
Calls that use the GHC API should be run in a separate process (one process for each open file???)
what is the purpose of the synchronized temp folder?
- save in there files not saved by the editor so that preprocessing et al can be done (run GHC on new file)
- having all files there mean we get an exact replica except of the changed file
- BUT we do not need it for builds!
synchronize
create/synchronize sub folder (.dist-toolname) and ensure all files that have changed in base folder are present in folder
read cabal config
- all src fields
- all exposed/other modules
- all Main-Is
- all data files
- Setup.hs?
-> requires configure to have a flattened description!
can take a file name and only work on that
can take a reset flag that ensure all files are the same (remove generated files)
configure
configure in proper folder
cabal API call
maybe a executable call + parse result is better (warnings and such will just be written to output, so we need to parse it anyway)
with additional flags (enable-tests)
parse errors and warnings
build
build in proper folder
require configure
cabal executable/API call?
parse errors and warnings
getAST
maybe several files at once in one session for performance
requires build
use GHC API
like in scion now
no link
use cabal flags
target wanted module (avoid unwanted side effects with errors)
use copied file in temp folder (means we should be able to use generated files, etc)
store AST to disk
qualified names
source locations
GHC AST issues:
- complexity
- parsed AST (not typechecked) can caus panics (placeholder types)
- we do not need the typed AST for a lot of operations
or only use haskell-src-exts?? And rely on scion-browser to find the qualified names? What about preprocessed names, etc...
- probably easier to use
- parseFileWithExts -> use extensions from all possible cabal components?
- determine cabal components from cabal files (file name -> module)
tokenTypes
- current scion code, lexing synchronized file
- need to transform file to remove preprocessing
- reuse a scion server?
occurences: use existing code
- or for performance, code in Eclipse (do not call executable)
beware the differences between token types and tokens! We do not get the token contents with just toekn types
thingAtPoint
requires getAST from GHC -> typechecked
load AST from disk and use current scion code
-> qualified name should allow us to find the location
outline
requires getAST
load AST from disk and use current scion code
- use new code if using haskell-src-exts
- done by client using JSON representation of AST
- may as well code a default implementation
- tested with rest of API
- much smaller size of JSON passed back
- can deal with haskell-src-exts data instead of JSON...
namesInScope?
GHC API names in scope -> requires typechecked module
- provide correct module with only imports -> always correct, only to get names?
- we could add a loop: generate module with only imports, if error then get line and remove imports
Use haskell-src-exts to get top level declarations
- use outline
Then we could just ignore GHC and use outline for declarations and scion-browser for other imports?
- but scion-browser doesn't know about our own project declarations
tokens (preceding,etc): still needed?
find available imports
lists all available symbols from modules (except modules after it in the dependency chain)
lists all available symbols from other packages
???
scion-browser gives us that
writeFileContents
take file name and string contents
write into temp folder
-> build
*** Of course in Eclipse we can just write the file ourselves (expose getTargetPath?) so we don't have to pass the file contents to executable
Just write the file in target, then call build/outline/tokens (even in parallel, by the way)
test
parse Cabal results...
architecture:
synchronize, configure, build, tokens, occurences, outline: single invocation of process: buildwrapper <command> <cabalfile> <filepath> <options>
thingAtPoint, namesInScope: start a buildwrapper server (IF PERF IS NOT GOOD ENOUGH VIA SINGLE INVOCATION)
buildwrapper start <cabalfile>
load <filepath>
getNamesInScope
getThingAtPoint <line> <col>
- one server per opened editor file
- reload module when synchronized
- stop and restart server when cabal file changes
- what about dependent modules?? can we find when they're modified and reload?
when an editor is saved:
- save contents to temp file in distbuildwrapper folder or call synchronize <filepath>
- call build False
- reload corresponding buildwrapper server
- call a reload on dependent buildwrapper servers
the "load" method of the buildwrapper server returns modules we depend on? -> "when one of them changes, reload me!"