syntax_tree 3.6.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fc4a522e982024b0361f9635ac6f5c7e60cfbb614aab5e58861649143c1353c
4
- data.tar.gz: f42f88445e6ef91e134fcc22441c17e372028db17a2d85be9ebc6eafd227bba0
3
+ metadata.gz: bd7e771d65269c131d28cd381186bb1e437e677d823f1219bc99a04d96d318c9
4
+ data.tar.gz: 9be18db6c8108ce433ec1acc07d4bc5d47969cc8aeca04786b92911c6e9e11c8
5
5
  SHA512:
6
- metadata.gz: 965a5878ac38cb5c44b867fb92a67913f505b655d25ececc73970ad6a24a1b73f13a0885a2943db5d7950acc4194355f113e4c8a680fdf00e43f024dd3cdab59
7
- data.tar.gz: 11ffd4beaec88f4b5c2af085cce12dea49368ab39b389fb16197c37d9570b25c45614881eed89dde0e8d195f64d1d284ff3713fc41a9dff0440ebea631df3afd
6
+ metadata.gz: f195700c3fbb9cd65ddf5a041e1fff5454aa4dc589b712d74205c126dd807b21e108e4c3d072a5af222f0cb22d1f9f45cf0cb70189498e86fbe6c80013f25622
7
+ data.tar.gz: c85dcdff58830ec44d96cf66f7814df8549646c7e0d3a9ebcf2dee364f45e7a0a3c3b46198fb6f0791eed2fc87f0d0be973dcd4008d60ba17e2a50c6026d5de1
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.6.1] - 2022-09-28
10
+
11
+ ### Changed
12
+
13
+ - [#161](https://github.com/ruby-syntax-tree/syntax_tree/pull/161) - Previously, we were checking if STDIN was a TTY to determine if there was content to be read. Instead, we now check if no filenames were passed, and in that case we attempt to read from STDIN. This should fix errors users were experiencing in non-TTY environments like CI.
14
+ - [#162](https://github.com/ruby-syntax-tree/syntax_tree/pull/162) - Parse errors shouldn't crash the language server anymore.
15
+
9
16
  ## [3.6.0] - 2022-09-19
10
17
 
11
18
  ### Added
@@ -350,7 +357,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
350
357
 
351
358
  - 🎉 Initial release! 🎉
352
359
 
353
- [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.6.0...HEAD
360
+ [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.6.1...HEAD
361
+ [3.6.1]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.6.0...v3.6.1
354
362
  [3.6.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.5.0...v3.6.0
355
363
  [3.5.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.4.0...v3.5.0
356
364
  [3.4.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.3.0...v3.4.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree (3.6.0)
4
+ syntax_tree (3.6.1)
5
5
  prettier_print
6
6
 
7
7
  GEM
@@ -423,19 +423,12 @@ module SyntaxTree
423
423
  return 1
424
424
  end
425
425
 
426
- # If we're not reading from stdin and the user didn't supply any
427
- # filepaths to be read, then we exit with the usage message.
428
- if $stdin.tty? && arguments.empty? && options.scripts.empty?
429
- warn(HELP)
430
- return 1
431
- end
432
-
433
426
  # We're going to build up a queue of items to process.
434
427
  queue = Queue.new
435
428
 
436
- # If we're reading from stdin, then we'll just add the stdin object to
437
- # the queue. Otherwise, we'll add each of the filepaths to the queue.
438
- if $stdin.tty? && (arguments.any? || options.scripts.any?)
429
+ # If there are any arguments or scripts, then we'll add those to the
430
+ # queue. Otherwise we'll read the content off STDIN.
431
+ if arguments.any? || options.scripts.any?
439
432
  arguments.each do |pattern|
440
433
  Dir
441
434
  .glob(pattern)
@@ -56,10 +56,10 @@ module SyntaxTree
56
56
  store.delete(uri)
57
57
  in { method: "textDocument/formatting", id:, params: { textDocument: { uri: } } }
58
58
  contents = store[uri]
59
- write(id: id, result: contents ? [format(store[uri], uri.split(".").last)] : nil)
59
+ write(id: id, result: contents ? format(contents, uri.split(".").last) : nil)
60
60
  in { method: "textDocument/inlayHint", id:, params: { textDocument: { uri: } } }
61
61
  contents = store[uri]
62
- write(id: id, result: contents ? inlay_hints(store[uri]) : nil)
62
+ write(id: id, result: contents ? inlay_hints(contents) : nil)
63
63
  in { method: "syntaxTree/visualizing", id:, params: { textDocument: { uri: } } }
64
64
  write(id: id, result: PP.pp(SyntaxTree.parse(store[uri]), +""))
65
65
  in { method: %r{\$/.+} }
@@ -89,19 +89,25 @@ module SyntaxTree
89
89
  def format(source, extension)
90
90
  text = SyntaxTree::HANDLERS[".#{extension}"].format(source, print_width)
91
91
 
92
- {
93
- range: {
94
- start: {
95
- line: 0,
96
- character: 0
92
+ [
93
+ {
94
+ range: {
95
+ start: {
96
+ line: 0,
97
+ character: 0
98
+ },
99
+ end: {
100
+ line: source.lines.size + 1,
101
+ character: 0
102
+ }
97
103
  },
98
- end: {
99
- line: source.lines.size + 1,
100
- character: 0
101
- }
102
- },
103
- newText: text
104
- }
104
+ newText: text
105
+ }
106
+ ]
107
+ rescue Parser::ParseError
108
+ # If there is a parse error, then we're not going to return any formatting
109
+ # changes for this source.
110
+ nil
105
111
  end
106
112
 
107
113
  def inlay_hints(source)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxTree
4
- VERSION = "3.6.0"
4
+ VERSION = "3.6.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prettier_print