steep 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 298dd973658fa586efbf59424298b54eb540a3e8f5b5c423f10ede9ae83d0d65
4
- data.tar.gz: f9a21241e44c10744d3305111b9afe499855931acda999b8671a2276ade4b2d9
3
+ metadata.gz: 6f40f4acb0e71a6cfd2b751297f2fc1a9cd18a87545d24cec51c0da5f1e9792e
4
+ data.tar.gz: 947ea73b078a7c1b9dc37e2855a6e483d1bbc919414b97226a3393bf92cb6bf8
5
5
  SHA512:
6
- metadata.gz: e110b36e04ba367ba26ce2f2a74b7aa6be20bb25df742af696803be795f7b372a92948f923c4b30548ad4c78657b0dcb19702a602721ef80136eb4f9d4e9daa1
7
- data.tar.gz: 2a4e44c76e29539b8692e31aa5cdd3f438715b978ef5d4e264d26191f634ff3c0ff58488d0334816ca8e6e6b1ff0ce3d0a35140c51e1dea78d7e3b56a31a3fdd
6
+ metadata.gz: b146bd6a93a59b5ec7a3029b061fc352c1e93c9bd87cfac89783b9a54175f076bc208a6f94adc32fa2a1802fdc94a422f1c64fbca555eb5ad93481ce7ff88b5d
7
+ data.tar.gz: d746bee9df6ab60f43811ec81a415348927bde046cba2cf7b2dd5e4204438e9dc317456ed9d61358fbbfe22125c569451687b9d528b17d1792e470e29dac43c1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.8.2 (2024-10-24)
4
+
5
+ ### Language server
6
+
7
+ * Ignore `didChangeWatchedFiles notification` for open files ([#1290](https://github.com/soutaro/steep/pull/1290))
8
+
9
+ ## 1.8.1 (2024-10-08)
10
+
11
+ ### Language server
12
+
13
+ * Skip sending response to `$/steep/typecheck` request from `steep langserver` ([#1268](https://github.com/soutaro/steep/pull/1268), backport [#1267](https://github.com/soutaro/steep/pull/1267))
14
+
3
15
  ## 1.8.0 (2024-09-30)
4
16
 
5
17
  ### Type checker core
@@ -165,6 +165,7 @@ module Steep
165
165
  request.signature_paths << project.absolute_path(path)
166
166
  end
167
167
 
168
+ request.needs_response = true
168
169
  master.start_type_check(request: request, last_request: nil, report_progress_threshold: 0)
169
170
 
170
171
  Steep.logger.info { "Starting type checking: #{request_guid}" }
@@ -162,7 +162,7 @@ module Steep
162
162
  master.job_queue << -> do
163
163
  Steep.logger.info { "Type checking for stats..." }
164
164
  progress = master.work_done_progress(typecheck_guid)
165
- master.start_type_check(last_request: nil, progress: progress, include_unchanged: true, report_progress_threshold: 0)
165
+ master.start_type_check(last_request: nil, progress: progress, include_unchanged: true, report_progress_threshold: 0, needs_response: true)
166
166
  end
167
167
  wait_for_message(reader: client_reader) do |message|
168
168
  message[:id] == typecheck_guid
@@ -12,6 +12,7 @@ module Steep
12
12
  attr_reader :checked_paths
13
13
  attr_reader :work_done_progress
14
14
  attr_reader :started_at
15
+ attr_accessor :needs_response
15
16
 
16
17
  def initialize(guid:, progress:)
17
18
  @guid = guid
@@ -22,6 +23,7 @@ module Steep
22
23
  @checked_paths = Set[]
23
24
  @work_done_progress = progress
24
25
  @started_at = Time.now
26
+ @needs_response = false
25
27
  end
26
28
 
27
29
  def uri(path)
@@ -700,13 +702,17 @@ module Steep
700
702
  end
701
703
 
702
704
  when "workspace/didChangeWatchedFiles"
705
+ updated_watched_files = [] #: Array[Pathname]
706
+
703
707
  message[:params][:changes].each do |change|
704
708
  uri = change[:uri]
705
709
  type = change[:type]
706
710
 
707
- path = PathHelper.to_pathname(uri) or next
711
+ path = PathHelper.to_pathname!(uri)
708
712
 
709
713
  unless controller.priority_paths.include?(path)
714
+ updated_watched_files << path
715
+
710
716
  controller.push_changes(path)
711
717
 
712
718
  case type
@@ -718,10 +724,16 @@ module Steep
718
724
  end
719
725
 
720
726
  content or raise
727
+
721
728
  broadcast_notification(CustomMethods::FileReset.notification({ uri: uri, content: content }))
722
729
  end
723
730
  end
724
731
 
732
+ if updated_watched_files.empty?
733
+ Steep.logger.info { "Exit from workspace/didChangeWatchedFiles notification because all of the changed files are already open" }
734
+ return
735
+ end
736
+
725
737
  if typecheck_automatically
726
738
  start_type_checking_queue.execute do
727
739
  job_queue.push(
@@ -732,7 +744,8 @@ module Steep
732
744
  start_type_check(
733
745
  last_request: last_request,
734
746
  include_unchanged: true,
735
- progress: work_done_progress(guid)
747
+ progress: work_done_progress(guid),
748
+ needs_response: false
736
749
  )
737
750
  end
738
751
  )
@@ -755,7 +768,8 @@ module Steep
755
768
 
756
769
  start_type_check(
757
770
  last_request: last_request,
758
- progress: work_done_progress(guid)
771
+ progress: work_done_progress(guid),
772
+ needs_response: false
759
773
  )
760
774
  end
761
775
  )
@@ -859,7 +873,8 @@ module Steep
859
873
  start_type_check(
860
874
  last_request: current_type_check_request,
861
875
  include_unchanged: true,
862
- progress: work_done_progress(guid || SecureRandom.uuid)
876
+ progress: work_done_progress(guid || SecureRandom.uuid),
877
+ needs_response: true
863
878
  )
864
879
 
865
880
  when "$/ping"
@@ -920,25 +935,27 @@ module Steep
920
935
  finished_at = Time.now
921
936
  duration = finished_at - request.started_at
922
937
 
923
- enqueue_write_job(
924
- SendMessageJob.to_client(
925
- message: CustomMethods::TypeCheck.response(
926
- request.guid,
927
- {
928
- guid: request.guid,
929
- completed: request.finished?,
930
- started_at: request.started_at.iso8601,
931
- finished_at: finished_at.iso8601,
932
- duration: duration.to_i
933
- }
938
+ if request.needs_response
939
+ enqueue_write_job(
940
+ SendMessageJob.to_client(
941
+ message: CustomMethods::TypeCheck.response(
942
+ request.guid,
943
+ {
944
+ guid: request.guid,
945
+ completed: request.finished?,
946
+ started_at: request.started_at.iso8601,
947
+ finished_at: finished_at.iso8601,
948
+ duration: duration.to_i
949
+ }
950
+ )
934
951
  )
935
952
  )
936
- )
937
-
938
- nil
953
+ else
954
+ Steep.logger.debug { "Skip sending response to #{CustomMethods::TypeCheck::METHOD} request" }
955
+ end
939
956
  end
940
957
 
941
- def start_type_check(request: nil, last_request:, progress: nil, include_unchanged: false, report_progress_threshold: 10)
958
+ def start_type_check(request: nil, last_request:, progress: nil, include_unchanged: false, report_progress_threshold: 10, needs_response: nil)
942
959
  Steep.logger.tagged "#start_type_check(#{progress&.guid || request&.guid}, #{last_request&.guid}" do
943
960
  if last_request
944
961
  finish_type_check(last_request)
@@ -947,6 +964,7 @@ module Steep
947
964
  unless request
948
965
  progress or raise
949
966
  request = controller.make_request(guid: progress.guid, include_unchanged: include_unchanged, progress: progress) or return
967
+ request.needs_response = needs_response ? true : false
950
968
  end
951
969
 
952
970
  if request.total > report_progress_threshold
@@ -960,7 +978,8 @@ module Steep
960
978
  end
961
979
 
962
980
  if request.finished?
963
- @current_type_check_request = finish_type_check(request)
981
+ finish_type_check(request)
982
+ @current_type_check_request = nil
964
983
  return
965
984
  end
966
985
  else
@@ -992,7 +1011,8 @@ module Steep
992
1011
  current.work_done_progress.report(percentage, "#{percentage}%")
993
1012
 
994
1013
  if current.finished?
995
- @current_type_check_request = finish_type_check(current)
1014
+ finish_type_check(current)
1015
+ @current_type_check_request = nil
996
1016
  end
997
1017
  end
998
1018
  end
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser