From b7cdf49ce65a5c48337b3aa70f5e333a36fca3ac Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Thu, 29 Feb 2024 17:22:14 -0500 Subject: [PATCH] fix: properly initiate progress notification --- .dialyzer_ignore.exs | 3 ++- lib/next_ls/progress.ex | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs index e15f6c80..781f4abf 100644 --- a/.dialyzer_ignore.exs +++ b/.dialyzer_ignore.exs @@ -1,4 +1,5 @@ [ {"lib/next_ls/lsp_supervisor.ex", :exact_eq}, - {"lib/next_ls/runtime.ex", :exact_eq} + {"lib/next_ls/runtime.ex", :exact_eq}, + {"lib/next_ls/progress.ex", :pattern_match} ] diff --git a/lib/next_ls/progress.ex b/lib/next_ls/progress.ex index 007d60f0..74572184 100644 --- a/lib/next_ls/progress.ex +++ b/lib/next_ls/progress.ex @@ -1,6 +1,18 @@ defmodule NextLS.Progress do @moduledoc false + @env Mix.env() def start(lsp, token, msg) do + # FIXME: gen_lsp should allow stubbing requests so we don't have to + # set this in every test. For now, don't send it in the test env + if @env != :test do + GenLSP.request(lsp, %GenLSP.Requests.WindowWorkDoneProgressCreate{ + id: System.unique_integer([:positive]), + params: %GenLSP.Structures.WorkDoneProgressCreateParams{ + token: token + } + }) + end + GenLSP.notify(lsp, %GenLSP.Notifications.DollarProgress{ params: %GenLSP.Structures.ProgressParams{ token: token,