mirror of
https://github.com/roc-lang/roc.git
synced 2024-10-04 22:27:55 +03:00
Merge pull request #6734 from roc-lang/narrow-lsp-report
Narrower reports from language server
This commit is contained in:
commit
3c189f4e36
12
.github/workflows/ubuntu_x86_64.yml
vendored
12
.github/workflows/ubuntu_x86_64.yml
vendored
@ -11,8 +11,6 @@ jobs:
|
|||||||
name: test zig, rust, wasm...
|
name: test zig, rust, wasm...
|
||||||
runs-on: [self-hosted, i7-6700K]
|
runs-on: [self-hosted, i7-6700K]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
env:
|
|
||||||
RUSTC_WRAPPER: /home/big-ci-user/.cargo/bin/sccache
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
- name: regular rust tests
|
- name: regular rust tests
|
||||||
# see #5904 for skipped test
|
# see #5904 for skipped test
|
||||||
run: cargo test --locked --release -- --skip cli_run::expects_dev_and_test && sccache --show-stats
|
run: cargo test --locked --release -- --skip cli_run::expects_dev_and_test
|
||||||
|
|
||||||
- name: tests examples in docs
|
- name: tests examples in docs
|
||||||
run: cargo test --doc --release
|
run: cargo test --doc --release
|
||||||
@ -48,19 +46,19 @@ jobs:
|
|||||||
run: cd examples/platform-switching/rust-platform && LD_LIBRARY_PATH=. cargo test --release --locked
|
run: cd examples/platform-switching/rust-platform && LD_LIBRARY_PATH=. cargo test --release --locked
|
||||||
|
|
||||||
- name: test the dev backend # these tests require an explicit feature flag
|
- name: test the dev backend # these tests require an explicit feature flag
|
||||||
run: cargo test --locked --release --package test_gen --no-default-features --features gen-dev && sccache --show-stats
|
run: cargo test --locked --release --package test_gen --no-default-features --features gen-dev
|
||||||
|
|
||||||
- name: test gen-wasm single threaded # gen-wasm has some multithreading problems to do with the wasmer runtime
|
- name: test gen-wasm single threaded # gen-wasm has some multithreading problems to do with the wasmer runtime
|
||||||
run: cargo test --locked --release --package test_gen --no-default-features --features gen-wasm -- --test-threads=1 && sccache --show-stats
|
run: cargo test --locked --release --package test_gen --no-default-features --features gen-wasm -- --test-threads=1
|
||||||
|
|
||||||
- name: roc test all builtins
|
- name: roc test all builtins
|
||||||
run: ./ci/roc_test_builtins.sh
|
run: ./ci/roc_test_builtins.sh
|
||||||
|
|
||||||
- name: wasm repl test
|
- name: wasm repl test
|
||||||
run: crates/repl_test/test_wasm.sh && sccache --show-stats
|
run: crates/repl_test/test_wasm.sh
|
||||||
|
|
||||||
- name: test building wasm repl
|
- name: test building wasm repl
|
||||||
run: ./ci/www-repl.sh && sccache --show-stats
|
run: ./ci/www-repl.sh
|
||||||
|
|
||||||
#TODO i386 (32-bit linux) cli tests
|
#TODO i386 (32-bit linux) cli tests
|
||||||
#TODO verify-no-git-changes
|
#TODO verify-no-git-changes
|
||||||
|
@ -112,7 +112,7 @@ pub(crate) fn global_analysis(doc_info: DocInfo) -> Vec<AnalyzedDocument> {
|
|||||||
src_dir,
|
src_dir,
|
||||||
roc_target::Target::LinuxX64,
|
roc_target::Target::LinuxX64,
|
||||||
roc_load::FunctionKind::LambdaSet,
|
roc_load::FunctionKind::LambdaSet,
|
||||||
roc_reporting::report::RenderTarget::Generic,
|
roc_reporting::report::RenderTarget::LanguageServer,
|
||||||
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
||||||
roc_reporting::report::DEFAULT_PALETTE,
|
roc_reporting::report::DEFAULT_PALETTE,
|
||||||
);
|
);
|
||||||
|
@ -202,9 +202,8 @@ pub(crate) mod diag {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let severity = report.severity.into_lsp_severity();
|
let severity = report.severity.into_lsp_severity();
|
||||||
|
|
||||||
let mut msg = String::new();
|
let mut msg = String::new();
|
||||||
report.render_ci(&mut msg, fmt.alloc);
|
report.render_language_server(&mut msg, fmt.alloc);
|
||||||
|
|
||||||
Some(Diagnostic {
|
Some(Diagnostic {
|
||||||
range,
|
range,
|
||||||
@ -239,7 +238,7 @@ pub(crate) mod diag {
|
|||||||
let severity = report.severity.into_lsp_severity();
|
let severity = report.severity.into_lsp_severity();
|
||||||
|
|
||||||
let mut msg = String::new();
|
let mut msg = String::new();
|
||||||
report.render_ci(&mut msg, fmt.alloc);
|
report.render_language_server(&mut msg, fmt.alloc);
|
||||||
|
|
||||||
Some(Diagnostic {
|
Some(Diagnostic {
|
||||||
range,
|
range,
|
||||||
|
@ -112,6 +112,7 @@ pub fn pretty_header_with_path(title: &str, path: &Path) -> String {
|
|||||||
pub enum RenderTarget {
|
pub enum RenderTarget {
|
||||||
ColorTerminal,
|
ColorTerminal,
|
||||||
Generic,
|
Generic,
|
||||||
|
LanguageServer,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A textual report.
|
/// A textual report.
|
||||||
@ -133,6 +134,7 @@ impl<'b> Report<'b> {
|
|||||||
match target {
|
match target {
|
||||||
RenderTarget::Generic => self.render_ci(buf, alloc),
|
RenderTarget::Generic => self.render_ci(buf, alloc),
|
||||||
RenderTarget::ColorTerminal => self.render_color_terminal(buf, alloc, palette),
|
RenderTarget::ColorTerminal => self.render_color_terminal(buf, alloc, palette),
|
||||||
|
RenderTarget::LanguageServer => self.render_language_server(buf, alloc),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +178,18 @@ impl<'b> Report<'b> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Render report for the language server, where the window is narrower.
|
||||||
|
/// Path is not included, and the header is not emphasized with "─".
|
||||||
|
pub fn render_language_server(self, buf: &mut String, alloc: &'b RocDocAllocator<'b>) {
|
||||||
|
let err_msg = "<buffer is not a utf-8 encoded string>";
|
||||||
|
|
||||||
|
alloc
|
||||||
|
.stack([alloc.text(self.title), self.doc])
|
||||||
|
.1
|
||||||
|
.render_raw(60, &mut CiWrite::new(buf))
|
||||||
|
.expect(err_msg)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn horizontal_rule(palette: &'b Palette) -> String {
|
pub fn horizontal_rule(palette: &'b Palette) -> String {
|
||||||
format!("{}{}", palette.header, "─".repeat(80))
|
format!("{}{}", palette.header, "─".repeat(80))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user