Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/oxlint/fixtures/lsp/js_config_basic/oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
categories: {
correctness: "off",
},
rules: {
"eqeqeq": "warn",
},
};
7 changes: 7 additions & 0 deletions apps/oxlint/fixtures/lsp/js_config_basic/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ok
const x = 42;

// eqeqeq warning
if (y == 42) {

}
20 changes: 18 additions & 2 deletions apps/oxlint/src/lsp/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use oxc_linter::ExternalLinter;

#[cfg(feature = "napi")]
use crate::js_config::JsConfigLoaderCb;
use crate::lsp::server_linter::ServerLinterBuilder;

mod code_actions;
mod commands;
mod error_with_position;
Expand All @@ -11,11 +15,23 @@ mod tester;
mod utils;

/// Run the language server
pub async fn run_lsp(external_linter: Option<ExternalLinter>) {
pub async fn run_lsp(
external_linter: Option<ExternalLinter>,
#[cfg(feature = "napi")] js_config_loader: Option<JsConfigLoaderCb>,
) {
let mut builder = ServerLinterBuilder::new(external_linter);
#[cfg(feature = "napi")]
if let Some(loader) = js_config_loader {
builder = builder.with_js_config_loader(Some(loader));
}
run_lsp_with_builder(builder).await;
}

async fn run_lsp_with_builder(builder: crate::lsp::server_linter::ServerLinterBuilder) {
oxc_language_server::run_server(
"oxlint".to_string(),
env!("CARGO_PKG_VERSION").to_string(),
vec![Box::new(crate::lsp::server_linter::ServerLinterBuilder::new(external_linter))],
vec![Box::new(builder)],
)
.await;
}
Loading
Loading