-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
85 lines (60 loc) · 2.51 KB
/
README
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
F# Refactor
===========
This is a refactoring library for F#. It currently provides the
following refactorings:
* Rename
* Extract an expression into a function
* Add an argument to a function
It can be used either via a command-line interface or using the Vim
bindings. The `Rename` refactoring is also included in the
[`fsharpbinding` add-in for
MonoDevelop](https://github.com/mono-soc-2013/fsharpbinding/tree/fsharp-refactor).
Calling it from the command-line is done like so:
Usage:
rename <position> <new_name> [<filename>]
extract-function <expression_range> <function_name> [<filename>]
add-argument <position> <argument_name> <default_value> [<filename>]
Options:
-h, --help Display this message and exit
-i[SUFFIX], --in-place=[SUFFIX] Modify the input file in-place (makes backup if extension supplied)
-oFILENAME, --output-file=FILENAME Write result to FILENAME
Positions should be written as `line:column`. Alternatively the Vim bindings
supply the functions:
* `:FSharpRename`
* `:FSharpExtractFunction`
* `:FSharpAddArgument`
`rename`
--------
`fsharp-refactor` currently allows renaming of identifiers bound in any of the following code constructs:
* Let statements
* Lambda abstractions
* Patterns (for example in match statements or `for ... in` loops)
* `for ... to` loops
It does not yet allow renaming of types, namespaces or modules. If
the renaming is done via the MonoDevelop add-in, the identifier will
be renamed throughout the containing project (but, as of yet, not the
entire solution).
`extract-function` and `add-argument`
-------------------------------------
These two refactorings are still under development, but you can try
them out using the command-line utility (or, if you're adventurous,
in the MonoDevelop plugin by compiling it yourself after removing the
appropriate comment in the .addin.xml file).
Installation
============
Command-line utility
--------------------
1. Clone the repository
`git clone https://github.com/Lewix/fsharp-refactor.git`
2. Run `autogen.sh` to generate and run the `configure` script and generate the makefile
`./autogen.sh`
3. Make and install the program
`make`
`make install`
The program can then be run from the command-line as
`fsharp-refactor`.
MonoDevelop add-in
------------------
Clone, and build the appropriate branch of
[`fsharpbinding`](https://github.com/mono-soc-2013/fsharpbinding/tree/fsharp-refactor)
and install the resulting .mpack file.