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

Commit 2586777

Browse files
authored
Add ignoredProjectPaths setting (#88)
1 parent bf3871c commit 2586777

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ function installCompiler() {
8686
return exec(`rustup toolchain install ${configToolchain()}`)
8787
}
8888

89+
/**
90+
* @param {string} projectPath
91+
* @return {bool} the project path has been explicitly disabled
92+
*/
93+
function shouldIgnoreProjectPath(projectPath) {
94+
const ignoredPaths = atom.config.get('ide-rust.ignoredProjectPaths')
95+
return ignoredPaths && ignoredPaths.split(',')
96+
.map(path => path.trim().replace(/[/\\]*$/, ''))
97+
.some(path => path === projectPath.trim().replace(/[/\\]*$/, ''))
98+
}
99+
89100
/**
90101
* @param {string} toolchain
91102
* @return {Promise<string>} `rustc --print sysroot` stdout
@@ -270,6 +281,7 @@ class RustLanguageClient extends AutoLanguageClient {
270281
description: 'Configuration default sent to all Rls instances, overridden by project rls.toml configuration',
271282
type: 'object',
272283
collapsed: false,
284+
order: 3,
273285
properties: {
274286
allTargets: {
275287
title: "Check All Targets",
@@ -288,6 +300,12 @@ class RustLanguageClient extends AutoLanguageClient {
288300
enum: ["On", "Opt-in", "Off", "Rls Default"]
289301
}
290302
}
303+
},
304+
ignoredProjectPaths: {
305+
description: 'Disables ide-rust functionality on a comma-separated list of project paths.',
306+
type: 'string',
307+
default: '',
308+
order: 999
291309
}
292310
}
293311
}
@@ -575,6 +593,13 @@ class RustLanguageClient extends AutoLanguageClient {
575593
}
576594

577595
async startServerProcess(projectPath) {
596+
if (shouldIgnoreProjectPath(projectPath)) {
597+
console.warn("ide-rust disabled on", projectPath)
598+
// It's a bit ugly to just return as it causes some upstream error logs
599+
// But there doesn't seem to be a better option for path disabling at the moment
600+
return
601+
}
602+
578603
if (!this._periodicUpdateChecking) {
579604
// if haven't started periodic checks for updates yet start now
580605
let periodicUpdateTimeoutId

0 commit comments

Comments
 (0)