fix: add missing error set
This commit is contained in:
		
							parent
							
								
									0542fdc680
								
							
						
					
					
						commit
						ee7fb21cee
					
				
					 2 changed files with 11 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -21,6 +21,12 @@ file_language_server: std.StringHashMap(LSP),
 | 
			
		|||
 | 
			
		||||
const Self = @This();
 | 
			
		||||
 | 
			
		||||
const OutOfMemoryError = error{OutOfMemory};
 | 
			
		||||
const SendError = error{SendFailed};
 | 
			
		||||
const CallError = tp.CallError;
 | 
			
		||||
const SpawnError = (OutOfMemoryError || error{ThespianSpawnFailed});
 | 
			
		||||
pub const InvalidMessageError = error{ InvalidMessage, InvalidMessageField, InvalidTargetURI };
 | 
			
		||||
 | 
			
		||||
const File = struct {
 | 
			
		||||
    path: []const u8,
 | 
			
		||||
    mtime: i128,
 | 
			
		||||
| 
						 | 
				
			
			@ -450,10 +456,6 @@ fn send_goto_request(self: *Self, from: tp.pid_ref, file_path: []const u8, row:
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const OutOfMemoryError = error{OutOfMemory};
 | 
			
		||||
pub const SendError = error{SendFailed};
 | 
			
		||||
pub const InvalidMessageError = error{ InvalidMessage, InvalidMessageField, InvalidTargetURI };
 | 
			
		||||
 | 
			
		||||
fn navigate_to_location_link(_: *Self, from: tp.pid_ref, location_link: []const u8) (SendError || InvalidMessageError || cbor.Error)!void {
 | 
			
		||||
    var iter = location_link;
 | 
			
		||||
    var targetUri: ?[]const u8 = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -882,7 +884,7 @@ pub fn send_lsp_response(self: *Self, from: tp.pid_ref, id: i32, result: anytype
 | 
			
		|||
    from.send(.{ "RSP", id, cb.items }) catch return error.SendFailed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn send_lsp_init_request(self: *Self, lsp: LSP, project_path: []const u8, project_basename: []const u8, project_uri: []const u8) (OutOfMemoryError || SendError)!tp.message {
 | 
			
		||||
fn send_lsp_init_request(self: *Self, lsp: LSP, project_path: []const u8, project_basename: []const u8, project_uri: []const u8) (OutOfMemoryError || SpawnError || CallError)!tp.message {
 | 
			
		||||
    return lsp.send_request(self.allocator, "initialize", .{
 | 
			
		||||
        .processId = if (builtin.os.tag == .linux) std.os.linux.getpid() else null,
 | 
			
		||||
        .rootPath = project_path,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -465,21 +465,21 @@ const Process = struct {
 | 
			
		|||
        return project.references(from, file_path, row, col);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn completion(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8, row: usize, col: usize) (ProjectError || Project.SendError || Project.GetFileLspError)!void {
 | 
			
		||||
    fn completion(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8, row: usize, col: usize) (ProjectError || SendError || Project.GetFileLspError)!void {
 | 
			
		||||
        const frame = tracy.initZone(@src(), .{ .name = module_name ++ ".completion" });
 | 
			
		||||
        defer frame.deinit();
 | 
			
		||||
        const project = self.projects.get(project_directory) orelse return error.NoProject;
 | 
			
		||||
        return project.completion(from, file_path, row, col);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn hover(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8, row: usize, col: usize) (ProjectError || Project.SendError || Project.InvalidMessageError || Project.GetFileLspError || cbor.Error)!void {
 | 
			
		||||
    fn hover(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8, row: usize, col: usize) (ProjectError || SendError || Project.InvalidMessageError || Project.GetFileLspError || cbor.Error)!void {
 | 
			
		||||
        const frame = tracy.initZone(@src(), .{ .name = module_name ++ ".hover" });
 | 
			
		||||
        defer frame.deinit();
 | 
			
		||||
        const project = self.projects.get(project_directory) orelse return error.NoProject;
 | 
			
		||||
        return project.hover(from, file_path, row, col);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn get_mru_position(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8) (ProjectError || Project.SendError)!void {
 | 
			
		||||
    fn get_mru_position(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8) (ProjectError || SendError)!void {
 | 
			
		||||
        const frame = tracy.initZone(@src(), .{ .name = module_name ++ ".get_mru_position" });
 | 
			
		||||
        defer frame.deinit();
 | 
			
		||||
        const project = self.projects.get(project_directory) orelse return error.NoProject;
 | 
			
		||||
| 
						 | 
				
			
			@ -491,7 +491,7 @@ const Process = struct {
 | 
			
		|||
        return project.update_mru(file_path, row, col);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn dispatch_notify(self: *Process, project_directory: []const u8, language_server: []const u8, method: []const u8, params_cb: []const u8) (ProjectError || Project.InvalidMessageError || Project.SendError || cbor.Error || cbor.JsonEncodeError)!void {
 | 
			
		||||
    fn dispatch_notify(self: *Process, project_directory: []const u8, language_server: []const u8, method: []const u8, params_cb: []const u8) (ProjectError || Project.InvalidMessageError || SendError || cbor.Error || cbor.JsonEncodeError)!void {
 | 
			
		||||
        _ = language_server;
 | 
			
		||||
        const project = self.projects.get(project_directory) orelse return error.NoProject;
 | 
			
		||||
        return if (std.mem.eql(u8, method, "textDocument/publishDiagnostics"))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue