Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit aa1a1e0

Browse files
authored
Add global rls clippy_preference setting (#71)
* Add global rls clippy_preference setting * Update readme mentioning support for clippy * Update dependencies
1 parent 29888ad commit aa1a1e0

File tree

5 files changed

+48
-23
lines changed

5 files changed

+48
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Rust language support for Atom-IDE, powered by the Rust Language Server (RLS).
55

66
## Features
77
- Auto-completion
8-
- Diagnostics (errors and warnings from `rustc`, `clippy` support is pending on [rls#149](https://github.com/rust-lang-nursery/rls/issues/149))
8+
- Diagnostics (errors and warnings from `rustc` and `clippy`, see `clippy_preference` setting)
99
- Document outline
1010
- Go to definition (`ctrl` or `cmd` click)
1111
- Type information and Documentation on hover (hold `ctrl` or `cmd` for more information)
@@ -14,7 +14,7 @@ Rust language support for Atom-IDE, powered by the Rust Language Server (RLS).
1414
- Format on save (disabled by default, see `atom-ide-ui` settings)
1515
- Rls toolchain selection in package settings
1616
- Rls toolchain update checking at startup & every 6 hours thereafter
17-
- Global Rls configuration for `all_targets`
17+
- Global Rls configuration for `all_targets`, `clippy_preference`
1818
- Per-project Rls configuration using `rls.toml` file at project root, see [rls#configuration](https://github.com/rust-lang-nursery/rls#configuration)
1919
```toml
2020
# rls.toml

lib/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ class RustLanguageClient extends AutoLanguageClient {
265265
default: "Rls Default",
266266
order: 1,
267267
enum: ["On", "Off", "Rls Default"]
268+
},
269+
clippyPreference: {
270+
title: "Clippy Preference",
271+
description: 'Controls eagerness of clippy diagnostics. `Opt-in` requires each crate specifying `#![warn(clippy)]. Note clippy is only available on Rls releases that have it enabled at compile time.',
272+
type: "string",
273+
default: "Rls Default",
274+
order: 2,
275+
enum: ["On", "Opt-in", "Off", "Rls Default"]
268276
}
269277
}
270278
}

lib/rls-project.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ class RlsProject {
122122

123123
// Default Rls config according to package settings & Rls defaults
124124
defaultConfig() {
125-
const { allTargets } = atom.config.get("ide-rust.rlsDefaultConfig")
125+
const { allTargets, clippyPreference } = atom.config.get("ide-rust.rlsDefaultConfig")
126126
const rlsConfig = {}
127127
if (allTargets === "On" || allTargets === "Off") {
128128
rlsConfig.all_targets = allTargets === "On"
129129
}
130+
if (clippyPreference !== "Rls Default") {
131+
rlsConfig.clippy_preference = clippyPreference
132+
}
130133
return rlsConfig
131134
}
132135
}

package-lock.json

Lines changed: 32 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
},
2020
"dependencies": {
2121
"atom-languageclient": "^0.9.4",
22-
"atom-package-deps": "^4.6.1",
22+
"atom-package-deps": "^4.6.2",
2323
"toml": "^2.3.3",
2424
"underscore-plus": "^1.6.6"
2525
},
2626
"devDependencies": {
27-
"eslint": "^4.18.2"
27+
"eslint": "^4.19.1"
2828
},
2929
"scripts": {
3030
"test": "eslint lib test --max-warnings 0"

0 commit comments

Comments
 (0)