Skip to content

Commit

Permalink
build-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mcecode committed Nov 26, 2024
1 parent 672ebc9 commit fa7e0ac
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build-debug-harper-ls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Debug

on:
push:
branches: ["build-debug-harper-ls"]

jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Build
run: cargo +stable build --locked --profile dev --bin harper-ls --target x86_64-unknown-linux-gnu
- name: Archive
run: |
cd target/x86_64-unknown-linux-gnu/debug
tar -czf ../../../harper-ls.tar.gz harper-ls
cd -
- name: Upload
uses: actions/upload-artifact@v4
with:
name: debug-build
path: harper-ls.tar.gz
37 changes: 37 additions & 0 deletions harper-ls/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use tower_lsp::lsp_types::{
InitializeResult, InitializedParams, MessageType, PublishDiagnosticsParams, Range,
ServerCapabilities, TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions,
TextDocumentSyncSaveOptions, Url,
DocumentDiagnosticParams, DocumentDiagnosticReportResult, DocumentDiagnosticReport,
RelatedFullDocumentDiagnosticReport, FullDocumentDiagnosticReport,
};
use tower_lsp::{Client, LanguageServer};
use tracing::{error, info};
Expand Down Expand Up @@ -175,6 +177,8 @@ impl Backend {
doc_state.linter = LintGroup::new(config_lock.lint_config, dict.clone());
}

doc_state.linter = LintGroup::new(config_lock.lint_config, dict.clone());

let Some(language_id) = &doc_state.language_id else {
doc_lock.remove(url);
return Ok(());
Expand Down Expand Up @@ -477,6 +481,39 @@ impl LanguageServer for Backend {

async fn did_change_configuration(&self, params: DidChangeConfigurationParams) {
self.update_config_from_obj(params.settings).await;

let urls: Vec<Url> = {
let doc_lock = self.doc_state.lock().await;
doc_lock.keys().cloned().collect()
};

for url in urls {
let _ = self.update_document_from_file(&url, None).await;
self.publish_diagnostics(&url).await;
}
}

async fn diagnostic(
&self,
params: DocumentDiagnosticParams,
) -> Result<DocumentDiagnosticReportResult> {
let _ = self
.update_document_from_file(&params.text_document.uri, None)
.await;
let diagnostics = self.generate_diagnostics(&params.text_document.uri).await;

Ok(DocumentDiagnosticReportResult::Report(
DocumentDiagnosticReport::Full(
RelatedFullDocumentDiagnosticReport {
full_document_diagnostic_report: FullDocumentDiagnosticReport {
items: diagnostics,
..Default::default()
},
..Default::default()
}
)
)
)
}

async fn code_action(&self, params: CodeActionParams) -> Result<Option<CodeActionResponse>> {
Expand Down

0 comments on commit fa7e0ac

Please sign in to comment.