File tree Expand file tree Collapse file tree 4 files changed +40
-19
lines changed Expand file tree Collapse file tree 4 files changed +40
-19
lines changed Original file line number Diff line number Diff line change
1
+ component Main {
2
+ fun render : String {
3
+ "". word
4
+ --------------------------------------------------------------------------------
5
+ ░ ERROR (ACCESS_EXPECTED_FIELD) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
6
+
7
+ I was expecting the name of the accessed entity but I found "a space" instead:
8
+
9
+ ┌ errors/access_expected_field_2:3:8
10
+ ├───────────────────────────────────
11
+ 1│ component Main {
12
+ 2│ fun render : String {
13
+ 3│ "". word
14
+ │ ⌃
Original file line number Diff line number Diff line change @@ -81,8 +81,11 @@ module Mint
81
81
target =
82
82
case value
83
83
in Parser
84
+ min =
85
+ value.char == '\0' ? 0 : 1
86
+
84
87
SnippetData .new(
85
- to: value.position.offset + value.word.to_s.size,
88
+ to: value.position.offset + [min, value.word.to_s.size].max ,
86
89
filename: value.file.relative_path,
87
90
from: value.position.offset,
88
91
input: value.file.contents)
Original file line number Diff line number Diff line change @@ -5,23 +5,27 @@ module Mint
5
5
next unless name = variable_constant(track: false ) ||
6
6
variable(track: false )
7
7
8
- whitespace
9
- if keyword! " as"
10
- whitespace
8
+ target =
9
+ parse do
10
+ whitespace
11
+ next unless keyword! " as"
12
+ whitespace
11
13
12
- next error :connect_variable_expected_as do
13
- block do
14
- text " The"
15
- bold " exposed name"
16
- text " of a connection"
17
- bold " must be specified, here is an example:"
18
- end
14
+ next error :connect_variable_expected_as do
15
+ block do
16
+ text " The"
17
+ bold " exposed name"
18
+ text " of a connection"
19
+ bold " must be specified, here is an example:"
20
+ end
19
21
20
- snippet " connect Store exposing { item as name }"
21
- expected " the exposed name" , word
22
- snippet self
23
- end unless target = variable
24
- end
22
+ snippet " connect Store exposing { item as name }"
23
+ expected " the exposed name" , word
24
+ snippet self
25
+ end unless variable = self .variable
26
+
27
+ variable
28
+ end
25
29
26
30
Ast ::ConnectVariable .new(
27
31
from: start_position,
Original file line number Diff line number Diff line change @@ -34,16 +34,16 @@ module Mint
34
34
self [0 , diff_from]
35
35
36
36
center =
37
- self [diff_from, diff_to].colorize.on( :white ).fore( :red ).to_s
37
+ self [diff_from, diff_to]
38
38
39
39
right =
40
40
self [diff_to, contents.size]
41
41
42
42
highlighted =
43
- left + center + right
43
+ left + center.colorize.on( :white ).fore( :red ).to_s + right
44
44
45
45
arrows =
46
- (" " * left.size) + (" ⌃" * center.uncolorize. size)
46
+ (" " * left.size) + (" ⌃" * center.size)
47
47
48
48
{highlighted, arrows}
49
49
end
You can’t perform that action at this time.
0 commit comments