<commit_before># Getting started

## Clone

```
git clone --recursive https://github.com/intellij-rust/intellij-rust.git
cd intellij-rust
```

## Building

To build the plugin just navigate to the directory you've previously checked it out and type `./gradlew build`. That's it.

This creates a zip archive in `build/distributions` which you can install with the `Install plugin from disk...` action found in `Settings > Plugins`.

## Running

To launch the plugin from console just type `./gradlew runIdea`.


## Development

For development you could use any editor/IDE of your choice. There is no peculiar dependency on IDEA, though we're particularly stuck to it, therefore providing instructions how to nail it from that side.

If you're using any other particular stack feel free to contribute to that list.

* [IDEA](#IDEA)


### IDEA

You can get the latest Intellij IDEA Community Edition [here](https://www.jetbrains.com/idea/download/).
You can also get the version from EAP channel [here](https://confluence.jetbrains.com/display/IDEADEV/EAP).

Import the plugin project as you would do with any other gradle based project.
For example, `Ctrl + Shift + A`, `Import project` and select `build.gradle` from
the root directory of the plugin.

To run or debug plugin from within the IDE use "gradle task" run configuration
for `runIdea` task. Another important task is `generate`. Use it if you change
`.flex` or `.bnf` files to generate the lexer and the parser.

To run test, execute "test" gradle task, or navigate to the interesting test
method, class or package and press `Ctrl+Shift+F10`.


# Contributing

To contribute to the code of the project check out the the latest version and follow instructions on how to build & run it.

If you feel yourself new to the field or don't know what you should start coping with check out issue-tracker for the
[up-for-grab](https://github.com/intellij-rust/intellij-rust/labels/up%20for%20grab) tasks as these may be greatest entry points to the project source code.

It's also very useful to submit fixes for the problems you face yourself when
using the plugin. It helps to prioritize the most important issues and is fun!

If you want to contribute to the project in any of the numerous other ways, first of all consider joining our [Gitter](https://gitter.im/alexeykudinkin/intellij-rust?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) therefore
being on par with the current development efforts.

Feel free to submit a work-in-progress pull request to collect early feedback.
When you are done with the PR, please make sure that all tests pass.


## Code style

Please, consider our [code-style](STYLE.md) prior to submitting the pull request. We love PRs, but much more than just PRs we love PRs that are 'on style'.

For the Java sources we're stuck to the Google's [one](https://google.github.io/styleguide/javaguide.html).

# Testing

It is much easier to understand code changes if they are accompanied with tests.
Test classes are placed in the `src/test/kotlin` directory, `src/test/resources`
holds rust files which are used as fixtures. Most tests are fixture driven: they
read the rust file named as the test itself, execute some action and check result.

We also include [CTRS](https://github.com/brson/ctrs) as a submodule and use it
to test the parser. We also download source code of the Rust standard library to
check that it is resolved correctly.

The test suite can be run by launching:

    ./gradlew test

To launch parser performance tests, use

    ./gradlew performanceTest


# Pull requests best practices

It's much easier to review small, focused pull requests. So if you can split
your changes into several chunks then please do it. There is no such thing as a
too small pull request.

Here is my typical workflow for submitting a pull request, but you don't need to
follow it exactly.

First, I press the fork button on the GitHub website to fork
`https://github.com/intellij-rust/intellij-rust` to
`https://github.com/matklad/intellij-rust`. Then I clone my fork:

```
$ git clone git://github.com/matklad/intellij-rust && cd intellij-rust
```

The next thing is usually creating a branch:

```
$ git checkout -b "useful-fix"
```

I can work directly on my fork's master branch, but having a dedicated PR branch
helps if I want to synchronize my work with upstream repository or if I want to
submit several pull requests.

Usually I try to keep my PRs one commit long:<commit_msg>(DOC): tweak wording<commit_after># Getting started

## Clone

```
git clone --recursive https://github.com/intellij-rust/intellij-rust.git
cd intellij-rust
```

## Building

To build the plugin just navigate to the directory you've previously checked it out and type `./gradlew build`. That's it.

This creates a zip archive in `build/distributions` which you can install with the `Install plugin from disk...` action found in `Settings > Plugins`.

## Running

To launch the plugin from console just type `./gradlew runIdea`.


## Development

For development you could use any editor/IDE of your choice. There is no peculiar dependency on IDEA, though we're particularly stuck to it, therefore providing instructions how to nail it from that side.

If you're using any other particular stack feel free to contribute to that list.

* [IDEA](#IDEA)


### IDEA

You can get the latest Intellij IDEA Community Edition [here](https://www.jetbrains.com/idea/download/).
You can also get the version from EAP channel [here](https://confluence.jetbrains.com/display/IDEADEV/EAP).

Import the plugin project as you would do with any other gradle based project.
For example, `Ctrl + Shift + A`, `Import project` and select `build.gradle` from
the root directory of the plugin.

To run or debug plugin from within the IDE use "gradle task" run configuration
for `runIdea` task. Another important task is `generate`. Use it if you change
`.flex` or `.bnf` files to generate the lexer and the parser.

To run test, execute "test" gradle task, or navigate to the interesting test
method, class or package and press `Ctrl+Shift+F10`.


# Contributing

To contribute to the code of the project check out the the latest version and follow instructions on how to build & run it.

If you feel yourself new to the field or don't know what you should start coping with check out issue-tracker for the
[up-for-grab](https://github.com/intellij-rust/intellij-rust/labels/up%20for%20grab) tasks as these may be greatest entry points to the project source code.

It's also very useful to submit fixes for the problems you face yourself when
using the plugin. It helps to prioritize the most important issues and is fun!

If you want to contribute to the project in any of the numerous other ways, first of all consider joining our [Gitter](https://gitter.im/alexeykudinkin/intellij-rust?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) therefore
being on par with the current development efforts.

Feel free to submit a work-in-progress pull request to collect early feedback.
When you are done with the PR, please make sure that all tests pass.


## Code style

Please, consider our [code-style](STYLE.md) prior to submitting the pull request. We love PRs, but much more than just PRs we love PRs that are 'on style'.

For the Java sources we're stuck to the Google's [one](https://google.github.io/styleguide/javaguide.html).

# Testing

It is much easier to understand code changes if they are accompanied with tests.
Test classes are placed in the `src/test/kotlin` directory, `src/test/resources`
holds rust files which are used as fixtures. Most tests are fixture driven: they
read the rust file named as the test itself, execute some action and check result.

We also include [CTRS](https://github.com/brson/ctrs) as a submodule and use it
to test the parser. We also download source code of the Rust standard library to
check that it is resolved correctly.

The test suite can be run by launching:

    ./gradlew test

To launch parser performance tests, use

    ./gradlew performanceTest


# Pull requests best practices

It's much easier to review small, focused pull requests. If you can split your
changes into several pull requests then please do it. There is no such thing as
a "too small" pull request.

Here is my typical workflow for submitting a pull request, but you don't need to
follow it exactly.

First, I press the fork button on the GitHub website to fork
`https://github.com/intellij-rust/intellij-rust` to
`https://github.com/matklad/intellij-rust`. Then I clone my fork:

```
$ git clone git://github.com/matklad/intellij-rust && cd intellij-rust
```

The next thing is usually creating a branch:

```
$ git checkout -b "useful-fix"
```

I can work directly on my fork's master branch, but having a dedicated PR branch
helps if I want to synchronize my work with upstream repository or if I want to
submit several pull requests.

Usually I try to keep my PRs one commit long:
{'fraction_non_alphanumeric': 0.07075419304676218, 'fraction_numerical': 0.0013328890369876708, 'mean_word_length': 4.231841952353283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '455019', 'n_tokens_mistral': 2555, 'n_tokens_neox': 2429, 'n_words': 1293}