gitnexus 1.6.6-rc.129 → 1.6.6-rc.130
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.
|
@@ -93,14 +93,11 @@ export function interpretGoTypeBinding(captures) {
|
|
|
93
93
|
}
|
|
94
94
|
export function normalizeGoTypeName(text) {
|
|
95
95
|
let t = text.trim();
|
|
96
|
-
|
|
97
|
-
t = t.slice(1).trim();
|
|
98
|
-
if (t.startsWith('[]'))
|
|
99
|
-
t = t.slice(2).trim();
|
|
96
|
+
t = stripGoOuterTypePrefixes(t);
|
|
100
97
|
const mapMatch = t.match(/^map\[[^\]]+\]\s*(.+)$/);
|
|
101
98
|
if (mapMatch)
|
|
102
99
|
t = mapMatch[1].trim();
|
|
103
|
-
t = t.replace(/^(?:<-)?chan
|
|
100
|
+
t = stripGoOuterTypePrefixes(t.replace(/^(?:<-)?chan(?:<-)?\s+/, ''));
|
|
104
101
|
if (t.startsWith('func(')) {
|
|
105
102
|
const retMatch = t.match(/^func\([^)]*\)\s*(.*)$/);
|
|
106
103
|
if (retMatch)
|
|
@@ -128,14 +125,11 @@ export function normalizeGoReturnType(text) {
|
|
|
128
125
|
const closeIdx = t.indexOf(',');
|
|
129
126
|
t = t.slice(1, closeIdx).trim();
|
|
130
127
|
}
|
|
131
|
-
|
|
132
|
-
t = t.slice(1).trim();
|
|
133
|
-
if (t.startsWith('[]'))
|
|
134
|
-
t = t.slice(2).trim();
|
|
128
|
+
t = stripGoOuterTypePrefixes(t);
|
|
135
129
|
const mapMatch = t.match(/^map\[[^\]]+\]\s*(.+)$/);
|
|
136
130
|
if (mapMatch)
|
|
137
131
|
t = mapMatch[1].trim();
|
|
138
|
-
t = t.replace(/^(?:<-)?chan
|
|
132
|
+
t = stripGoOuterTypePrefixes(t.replace(/^(?:<-)?chan(?:<-)?\s+/, ''));
|
|
139
133
|
if (t.startsWith('func(')) {
|
|
140
134
|
const retMatch = t.match(/^func\([^)]*\)\s*(.*)$/);
|
|
141
135
|
if (retMatch)
|
|
@@ -147,3 +141,16 @@ export function normalizeGoReturnType(text) {
|
|
|
147
141
|
t = t.slice(0, bracket);
|
|
148
142
|
return t;
|
|
149
143
|
}
|
|
144
|
+
function stripGoOuterTypePrefixes(text) {
|
|
145
|
+
let t = text.trim();
|
|
146
|
+
let previous;
|
|
147
|
+
do {
|
|
148
|
+
previous = t;
|
|
149
|
+
while (t.startsWith('*'))
|
|
150
|
+
t = t.slice(1).trim();
|
|
151
|
+
if (t.startsWith('[]'))
|
|
152
|
+
t = t.slice(2).trim();
|
|
153
|
+
t = t.replace(/^\[[^\]]+\]\s*/, '');
|
|
154
|
+
} while (t !== previous);
|
|
155
|
+
return t;
|
|
156
|
+
}
|
|
@@ -70,14 +70,14 @@ const GO_SCOPE_QUERY = `
|
|
|
70
70
|
parameters: (parameter_list
|
|
71
71
|
(parameter_declaration
|
|
72
72
|
name: (identifier) @type-binding.name
|
|
73
|
-
type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type)] @type-binding.type))) @type-binding.parameter
|
|
73
|
+
type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type) (channel_type) (array_type) (function_type) (interface_type) (generic_type)] @type-binding.type))) @type-binding.parameter
|
|
74
74
|
|
|
75
75
|
(method_declaration
|
|
76
76
|
name: (field_identifier) @_fn_name
|
|
77
77
|
parameters: (parameter_list
|
|
78
78
|
(parameter_declaration
|
|
79
79
|
name: (identifier) @type-binding.name
|
|
80
|
-
type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type)] @type-binding.type))) @type-binding.parameter
|
|
80
|
+
type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type) (channel_type) (array_type) (function_type) (interface_type) (generic_type)] @type-binding.type))) @type-binding.parameter
|
|
81
81
|
|
|
82
82
|
;; Type bindings — constructor-inferred (:= T{})
|
|
83
83
|
(short_var_declaration
|
package/package.json
CHANGED