language_server 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/benchmark/ruby_wc +22 -0
- data/language_server.gemspec +1 -0
- data/lib/language_server/linter/ruby_wc.rb +47 -4
- data/lib/language_server/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7139ff0bb62fcf30de5f216cc102cc2e06a52f8a
|
4
|
+
data.tar.gz: '019a3200bde8868ffa962478c9a0f5347adeebdb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dae2397674045b4c88433c9efd9d4191739f2ed0cd36f908a86aca03d634bde4f1741900539439a72c252600f89008f7149d28b24cba6fc62e4d1963c724b406
|
7
|
+
data.tar.gz: 6c49f740e25807d8856df833c297d02a42802863d1abeb2b9c5278c9968d87c69c69b7be59ef7c79a1ebbc5d14a2a6e290adc91390e196aff4b75c54ca854818
|
data/CHANGELOG.md
CHANGED
data/benchmark/ruby_wc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'benchmark/ips'
|
5
|
+
require 'language_server'
|
6
|
+
|
7
|
+
error_code = <<-EOS
|
8
|
+
require "foo
|
9
|
+
if a == "\\n"
|
10
|
+
EOS
|
11
|
+
warn_code = <<-EOS
|
12
|
+
a = 1
|
13
|
+
EOS
|
14
|
+
valid_code = File.read(__FILE__)
|
15
|
+
|
16
|
+
Benchmark.ips do |x|
|
17
|
+
x.report do
|
18
|
+
[error_code, warn_code, valid_code].each do |code|
|
19
|
+
LanguageServer::Linter::RubyWC.new(code).call
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/language_server.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "stringio"
|
2
2
|
|
3
3
|
module LanguageServer
|
4
4
|
module Linter
|
@@ -26,12 +26,55 @@ module LanguageServer
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def call
|
29
|
-
|
30
|
-
|
31
|
-
err.scan(/.+:(\d+):\s*(.+?)[,:]\s(.+)/).map do |line_num, type, message|
|
29
|
+
error_message.scan(/.+:(\d+):\s*(.+?)[,:]\s(.+)/).map do |line_num, type, message|
|
32
30
|
Error.new(line_num: line_num.to_i - 1, message: message, type: type)
|
33
31
|
end
|
34
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# Since Ruby 2.4, syntax error information is outputted to Exception#message instead of stderr
|
37
|
+
if begin; stderr = $stderr; $stderr = StringIO.new; RubyVM::InstructionSequence.compile('='); rescue SyntaxError => e; e.message != 'compile error'; ensure; $stderr = stderr; end
|
38
|
+
def error_message
|
39
|
+
with_verbose do
|
40
|
+
begin
|
41
|
+
capture_stderr { RubyVM::InstructionSequence.compile(@source) }
|
42
|
+
rescue SyntaxError => e
|
43
|
+
e.message
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
def error_message
|
49
|
+
with_verbose do
|
50
|
+
capture_stderr do
|
51
|
+
begin
|
52
|
+
RubyVM::InstructionSequence.compile(@source)
|
53
|
+
rescue SyntaxError
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def with_verbose
|
61
|
+
origin = $VERBOSE
|
62
|
+
$VERBOSE = true
|
63
|
+
yield
|
64
|
+
ensure
|
65
|
+
$VERBOSE = origin
|
66
|
+
end
|
67
|
+
|
68
|
+
def capture_stderr
|
69
|
+
origin = $stderr
|
70
|
+
$stderr = StringIO.new
|
71
|
+
|
72
|
+
yield
|
73
|
+
|
74
|
+
$stderr.string
|
75
|
+
ensure
|
76
|
+
$stderr = origin
|
77
|
+
end
|
35
78
|
end
|
36
79
|
end
|
37
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: language_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumiaki MATSUSHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rcodetools
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: benchmark-ips
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: A Ruby Language Server implementation
|
140
154
|
email:
|
141
155
|
- mtsmfm@gmail.com
|
@@ -154,6 +168,7 @@ files:
|
|
154
168
|
- LICENSE.txt
|
155
169
|
- README.md
|
156
170
|
- Rakefile
|
171
|
+
- benchmark/ruby_wc
|
157
172
|
- bin/console
|
158
173
|
- bin/language_server-ruby
|
159
174
|
- bin/m
|