You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-20Lines changed: 61 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,25 @@ MGD uses static analysis to guide the decoding of LMs, to generate code followin
18
18
19
19

20
20
21
+
## Environment Setup
22
+
We use the Python packages listed in [requirements.txt](requirements.txt). Our experiments used python 3.10. It is recommended to install the same with dependencies in an isolated virtual environment. To create a virtual environment using `venv`:
23
+
```setup
24
+
python3 -m venv venv_monitors4codegen
25
+
source venv_monitors4codegen/bin/activate
26
+
```
27
+
or using conda:
28
+
```
29
+
conda create -n monitors4codegen python=3.10
30
+
conda activate monitors4codegen
31
+
```
32
+
Further details and instructions on creation of python virtual environments can be found in the [official documentation](https://docs.python.org/3/library/venv.html). Further, we also refer users to [Miniconda](https://docs.conda.io/en/latest/miniconda.html), as an alternative to the above steps for creation of the virtual environment.
33
+
34
+
To install the requirements for running evaluations as described [below](#2-evaluation-scripts):
35
+
36
+
```setup
37
+
pip3 install -r requirements.txt
38
+
```
39
+
21
40
## 1. Datasets
22
41
23
42
### Dataset Statistics
@@ -38,25 +57,6 @@ DotPrompts is a set of testcases derived from PragmaticCode, such that each test
38
57
The complete description of a testcase in DotPrompts is a tuple - `(repo, classFileName, methodStartIdx, methodStopIdx, dot_idx)`. The dataset is available at [datasets/DotPrompts/dataset.csv](datasets/DotPrompts/dataset.csv).
39
58
40
59
## 2. Evaluation Scripts
41
-
### Environment Setup
42
-
We use the Python packages listed in [requirements.txt](requirements.txt). Our experiments used python 3.10. It is recommended to install the same with dependencies in an isolated virtual environment. To create a virtual environment using `venv`:
43
-
```setup
44
-
python3 -m venv venv_monitors4codegen
45
-
source venv_monitors4codegen/bin/activate
46
-
```
47
-
or using conda:
48
-
```
49
-
conda create -n monitors4codegen python=3.10
50
-
conda activate monitors4codegen
51
-
```
52
-
Further details and instructions on creation of python virtual environments can be found in the [official documentation](https://docs.python.org/3/library/venv.html). Further, we also refer users to [Miniconda](https://docs.conda.io/en/latest/miniconda.html), as an alternative to the above steps for creation of the virtual environment.
53
-
54
-
To install the requirements for running evaluation as described below:
The above command creates a directory [results](results/) (already included in the repository), containing all the figures and tables provided in the paper along with extra details. The command also generates a report in the output directory which relates the generated figures to sections in the paper. In case of above command, the report is generated at [results/Report.md](results/Report.md).
102
102
103
103
## 4. `multilspy`
104
+
`multilspy` is a cross-platform library to set up and interact with various language servers in a unified and easy way. [Language servers]((https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/)) are tools that perform a variety of static analyses on source code and provide useful information such as type-directed code completion suggestions, symbol definition locations, symbol references, etc., over the [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/). `multilspy` intends to ease the process of using language servers, by abstracting the setting up of the language servers, performing language-specific configuration and handling communication with the server over the json-rpc based protocol, while exposing a simple interface to the user.
105
+
106
+
Since LSP is language-agnostic, `multilspy` can provide the results for static analyses of code in different languages over a common interface. `multilspy` is easily extensible to any language that has a Language Server and currently supports Java, Rust, C# and Python and we aim to support more language servers from the [list of language server implementations](https://microsoft.github.io/language-server-protocol/implementors/servers/).
107
+
108
+
Some of the analyses results that `multilspy` can provide are:
109
+
- Finding the definition of a function or a class ([textDocument/definition](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition))
110
+
- Finding the callers of a function or the instantiations of a class ([textDocument/references](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_references))
"relative/path/to/code_file.java", # Filename of location where request is being made
125
+
163, # line number of symbol for which request is being made
126
+
4# column number of symbol for which request is being made
127
+
)
128
+
...
129
+
```
104
130
105
-
Coming Soon...
131
+
`multilspy` also provides an asyncio based API which can be used in async contexts. Example usage (asyncio):
132
+
```python
133
+
from multilspy import LanguageServer
134
+
...
135
+
lsp = LanguageServer.create(...)
136
+
asyncwith lsp.start_server():
137
+
result =await lsp.request_definition(
138
+
...
139
+
)
140
+
...
141
+
```
142
+
143
+
Several tests for `multilspy` present under [tests/multilspy/](tests/multilspy/) provide detailed usage examples for `multilspy`. The tests can be executed by running:
0 commit comments