@@ -4,14 +4,12 @@ import GLib from "gi://GLib";
44import LSPClient from "../../lsp/LSPClient.js" ;
55
66export function setup ( { data_dir, document } ) {
7- const { file : state_file , code_view } = document ;
7+ const { file, code_view } = document ;
88
99 const api_file = Gio . File . new_for_path (
1010 GLib . build_filenamev ( [ pkg . pkgdatadir , "workbench-api.vala" ] ) ,
1111 ) ;
1212
13- const uri = state_file . get_uri ( ) ;
14-
1513 api_file . copy (
1614 Gio . File . new_for_path ( data_dir ) . get_child ( "workbench.vala" ) ,
1715 Gio . FileCopyFlags . OVERWRITE ,
@@ -21,9 +19,8 @@ export function setup({ data_dir, document }) {
2119
2220 const lspc = createLSPClient ( {
2321 code_view,
24- uri,
22+ uri : file . get_uri ( ) ,
2523 data_dir,
26- state_file,
2724 } ) ;
2825
2926 lspc . start ( ) . catch ( logError ) ;
@@ -33,7 +30,7 @@ export function setup({ data_dir, document }) {
3330 } ) ;
3431}
3532
36- function createLSPClient ( { code_view, uri, data_dir, state_file } ) {
33+ function createLSPClient ( { code_view, uri, data_dir } ) {
3734 const lspc = new LSPClient (
3835 [
3936 // "/usr/lib/sdk/vala/bin/vala-language-server",
@@ -58,11 +55,11 @@ function createLSPClient({ code_view, uri, data_dir, state_file }) {
5855
5956 lspc . connect (
6057 "notification::textDocument/publishDiagnostics" ,
61- ( _self , { diagnostics , uri } ) => {
62- if ( ! state_file . equal ( Gio . File . new_for_uri ( uri ) ) ) {
58+ ( _self , params ) => {
59+ if ( params . uri !== uri ) {
6360 return ;
6461 }
65- code_view . handleDiagnostics ( diagnostics ) ;
62+ code_view . handleDiagnostics ( params . diagnostics ) ;
6663 } ,
6764 ) ;
6865
0 commit comments