Created
February 2, 2021 08:52
-
-
Save juchiast/d42a587ac806509017d2c0f0ce9bffd5 to your computer and use it in GitHub Desktop.
YCM config for rust-analyzer with automatic features detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import path | |
noDefaultFeatures = False | |
features = [] | |
BASE = path.dirname(__file__) | |
try: | |
check_file = open(path.join(BASE, "check"), "r").read() | |
for line in check_file.splitlines(): | |
line = line.strip() | |
if line.startswith("#"): | |
continue | |
if "--no-default-features" in line: | |
noDefaultFeatures = True | |
parts = line.split(" ") | |
idx = None | |
for (i, part) in enumerate(parts): | |
if part == "--features": | |
idx = i | |
break | |
if idx is not None and idx + 1 < len(parts): | |
features = parts[idx + 1].split(",") | |
except: | |
pass | |
print(noDefaultFeatures) | |
print(features) | |
def Settings( **kwargs ): | |
if kwargs[ 'language' ] == 'rust': | |
settings = { 'ls': { 'checkOnSave' : { 'enable': False } } } | |
settings['ls']['cargo'] = { 'noDefaultFeatures': noDefaultFeatures, 'features': features } | |
return settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
set -Eeuxo pipefail | |
# cargo check --no-default-features --features sinks-loki,loki-integration-tests --tests | |
# cargo check --no-default-features --features sinks-elasticsearch,es-integration-tests --tests | |
# cargo check --no-default-features --features sources-docker_logs,docker-logs-integration-tests --tests | |
cargo check --no-default-features --features sinks-gcp --tests | |
# cargo check --tests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment