Skip to content

Commit

Permalink
build-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mcecode committed Nov 23, 2024
1 parent f5d283f commit c3706aa
Show file tree
Hide file tree
Showing 2 changed files with 57 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
29 changes: 29 additions & 0 deletions harper-ls/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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 @@ -163,6 +165,10 @@ impl Backend {
let mut doc_lock = self.doc_state.lock().await;
let config_lock = self.config.read().await;

self.client
.log_message(MessageType::INFO, url)
.await;

let dict = Arc::new(self.generate_file_dictionary(url).await?);

let doc_state = doc_lock.entry(url.clone()).or_insert(DocumentState {
Expand Down Expand Up @@ -481,6 +487,29 @@ impl LanguageServer for Backend {
self.update_config_from_obj(params.settings).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>> {
let actions = self
.generate_code_actions(&params.text_document.uri, params.range)
Expand Down

0 comments on commit c3706aa

Please sign in to comment.