更新结构

This commit is contained in:
锦恢 2024-09-07 19:37:26 +08:00
parent 2b455a838d
commit 00ec7abc6c
4 changed files with 42 additions and 45 deletions

View File

@ -1,20 +1,10 @@
use crate::server::ProjectConfig;
#[cfg(feature = "slang")]
use path_clean::PathClean;
use regex::Regex;
use ropey::Rope;
#[cfg(feature = "slang")]
use std::env::current_dir;
#[cfg(feature = "slang")]
use std::path::Path;
use std::path::PathBuf;
use std::process::{Command, Stdio};
use tower_lsp::lsp_types::*;
#[cfg(feature = "slang")]
use veridian_slang::slang_compile;
use walkdir::DirEntry;
#[cfg(feature = "slang")]
use walkdir::WalkDir;
#[cfg(feature = "slang")]
pub fn get_diagnostics(

View File

@ -16,7 +16,7 @@ mod support;
use server::Backend;
#[derive(StructOpt, Debug)]
#[structopt(name = "veridian", about = "A SystemVerilog/Verilog Language Server")]
#[structopt(name = "Digtal LSP", about = "LSP for Digital IDE")]
struct Opt {}
#[tokio::main]
@ -25,7 +25,8 @@ async fn main() {
let log_handle = flexi_logger::Logger::with(flexi_logger::LogSpecification::info())
.start()
.unwrap();
info!("starting veridian...");
info!("launch Digital LSP");
let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();

View File

@ -296,7 +296,7 @@ impl LanguageServer for Backend {
}
async fn initialized(&self, _: InitializedParams) {
self.client
.log_message(MessageType::INFO, "veridian initialized!")
.log_message(MessageType::INFO, "digital lsp initialized!")
.await;
}
async fn shutdown(&self) -> Result<()> {

View File

@ -4,12 +4,13 @@
* ------------------------------------------------------------------------------------------ */
import { workspace, ExtensionContext } from "vscode";
import * as path from 'path';
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
Executable,
LanguageClient,
LanguageClientOptions,
ServerOptions,
Executable,
} from "vscode-languageclient/node";
let client: LanguageClient;
@ -17,39 +18,44 @@ const workSpaceFolder = workspace.workspaceFolders?.[0];
let cwd: string = workSpaceFolder.uri.fsPath;
export function activate(context: ExtensionContext) {
const run: Executable = {
command: context.asAbsolutePath('target/debug/digital-lsp.exe'),
// options: { cwd },
};
const lspServerPath = path.resolve(
context.extensionPath, '..', '..', 'target', 'debug', 'digital-lsp.exe'
);
console.log('launch lsp in ', lspServerPath);
const run: Executable = {
command: lspServerPath,
// options: { cwd },
};
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
let serverOptions: ServerOptions = {
run,
debug: run,
};
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
let serverOptions: ServerOptions = {
run,
debug: run,
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: "file", language: "systemverilog" }],
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: "file", language: "systemverilog" }],
};
// Create the language client and start the client.
client = new LanguageClient(
"Digital LSP",
"Digital LSP",
serverOptions,
clientOptions
);
// Create the language client and start the client.
client = new LanguageClient(
"Digital LSP",
"Digital LSP",
serverOptions,
clientOptions
);
// Start the client. This will also launch the server
client.start();
// Start the client. This will also launch the server
client.start();
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
if (!client) {
return undefined;
}
return client.stop();
}