Skip to content

Commit 8f79cd2

Browse files
committed
Comment out scope thing
1 parent b2a26a0 commit 8f79cd2

File tree

3 files changed

+113
-5
lines changed

3 files changed

+113
-5
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
11251125
~pos ~scope ~debug ~prefix ~env ~rawOpens ~full completionPath
11261126
|> TypeUtils.filterPipeableFunctions ~env ~full ~synthetic
11271127
~targetTypeId:mainTypeId
1128-
|> List.filter (fun (c : Completion.t) ->
1128+
(* |> List.filter (fun (c : Completion.t) ->
11291129
(* If we're completing from the current module then we need to care about scope.
11301130
This is automatically taken care of in other cases. *)
11311131
if isFromCurrentModule then
@@ -1139,7 +1139,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
11391139
| _ -> false)
11401140
|> Option.is_some
11411141
| _ -> false
1142-
else true)
1142+
else true) *)
11431143
in
11441144
(* Extra completions can be drawn from the @editor.completeFrom attribute. Here we
11451145
find and add those completions as well. *)

tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ Path Js_string2.st
172172
"documentation": {"kind": "markdown", "value": "Turns `string` into a JSX element so it can be used inside of JSX."},
173173
"sortText": "A",
174174
"insertTextFormat": 2
175+
}, {
176+
"label": "Js_string2.startsWith",
177+
"kind": 12,
178+
"tags": [],
179+
"detail": "(t, t) => bool",
180+
"documentation": {"kind": "markdown", "value": "\nES2015: `startsWith(str, substr)` returns `true` if the `str` starts with\n`substr`, `false` otherwise.\n\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.startsWith(\"ReScript\", \"Re\") == true\nJs.String2.startsWith(\"ReScript\", \"\") == true\nJs.String2.startsWith(\"JavaScript\", \"Re\") == false\n```\n"}
181+
}, {
182+
"label": "Js_string2.startsWithFrom",
183+
"kind": 12,
184+
"tags": [],
185+
"detail": "(t, t, int) => bool",
186+
"documentation": {"kind": "markdown", "value": "\nES2015: `startsWithFrom(str, substr, n)` returns `true` if the `str` starts\nwith `substr` starting at position `n`, false otherwise. If `n` is negative,\nthe search starts at the beginning of `str`.\n\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.startsWithFrom(\"ReScript\", \"Scri\", 2) == true\nJs.String2.startsWithFrom(\"ReScript\", \"\", 2) == true\nJs.String2.startsWithFrom(\"JavaScript\", \"Scri\", 2) == false\n```\n"}
175187
}]
176188

177189
Complete src/CompletionJsx.res 24:19

tests/analysis_tests/tests/src/expected/DotPipeCompletionSpec.res.txt

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ Path DotPipeCompletionSpec.SomeOtherModule.
281281
"tags": [],
282282
"detail": "string",
283283
"documentation": {"kind": "markdown", "value": "```rescript\nnname: string\n```\n\n```rescript\ntype typeOutsideModule = {nname: string}\n```"}
284+
}, {
285+
"label": "->outOfScope",
286+
"kind": 12,
287+
"tags": [],
288+
"detail": "typeOutsideModule => typeOutsideModule",
289+
"documentation": null,
290+
"sortText": "outOfScope",
291+
"insertText": "->outOfScope",
292+
"additionalTextEdits": [{
293+
"range": {"start": {"line": 80, "character": 6}, "end": {"line": 80, "character": 7}},
294+
"newText": ""
295+
}]
284296
}, {
285297
"label": "->doWithTypeOutsideModule",
286298
"kind": 12,
@@ -293,6 +305,18 @@ Path DotPipeCompletionSpec.SomeOtherModule.
293305
"range": {"start": {"line": 80, "character": 6}, "end": {"line": 80, "character": 7}},
294306
"newText": ""
295307
}]
308+
}, {
309+
"label": "->cc",
310+
"kind": 12,
311+
"tags": [],
312+
"detail": "typeOutsideModule => typeOutsideModule",
313+
"documentation": null,
314+
"sortText": "cc",
315+
"insertText": "->cc",
316+
"additionalTextEdits": [{
317+
"range": {"start": {"line": 80, "character": 6}, "end": {"line": 80, "character": 7}},
318+
"newText": ""
319+
}]
296320
}, {
297321
"label": "->SomeOtherModule.getNName",
298322
"kind": 12,
@@ -335,7 +359,31 @@ ContextPath Value[Js, Array2, filter]
335359
Path Js.Array2.filter
336360
CPPipe pathFromEnv: found:true
337361
Path Js_array2.filt
338-
[]
362+
[{
363+
"label": "->Js_array2.filter",
364+
"kind": 12,
365+
"tags": [],
366+
"detail": "(t<'a>, 'a => bool) => t<'a>",
367+
"documentation": {"kind": "markdown", "value": "\nApplies the given predicate function (the second argument) to each element in\nthe array; the result is an array of those elements for which the predicate\nfunction returned `true`. See\n[`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)\non MDN.\n\n## Examples\n\n```rescript\nlet nonEmpty = s => s != \"\"\nJs.Array2.filter([\"abc\", \"\", \"\", \"def\", \"ghi\"], nonEmpty) == [\"abc\", \"def\", \"ghi\"]\n```\n"},
368+
"sortText": "filter",
369+
"insertText": "->Js_array2.filter",
370+
"additionalTextEdits": [{
371+
"range": {"start": {"line": 86, "character": 38}, "end": {"line": 86, "character": 39}},
372+
"newText": ""
373+
}]
374+
}, {
375+
"label": "->Js_array2.filteri",
376+
"kind": 12,
377+
"tags": [],
378+
"detail": "(t<'a>, ('a, int) => bool) => t<'a>",
379+
"documentation": {"kind": "markdown", "value": "\nEach element of the given array are passed to the predicate function. The\nreturn value is an array of all those elements for which the predicate function\nreturned `true`.\n\nSee\n[`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)\non MDN.\n\n## Examples\n\n```rescript\n// keep only positive elements at odd indices\nlet positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0\n\nJs.Array2.filteri([6, 3, 5, 8, 7, -4, 1], positiveOddElement) == [3, 8]\n```\n"},
380+
"sortText": "filteri",
381+
"insertText": "->Js_array2.filteri",
382+
"additionalTextEdits": [{
383+
"range": {"start": {"line": 86, "character": 38}, "end": {"line": 86, "character": 39}},
384+
"newText": ""
385+
}]
386+
}]
339387

340388
Complete src/DotPipeCompletionSpec.res 89:70
341389
posCursor:[89:70] posNoWhite:[89:69] Found expr:[89:3->89:70]
@@ -393,7 +441,19 @@ ContextPath Value[Js, String2, toLowerCase]
393441
Path Js.String2.toLowerCase
394442
CPPipe pathFromEnv: found:true
395443
Path Js_string2.toUpperCa
396-
[]
444+
[{
445+
"label": "->Js_string2.toUpperCase",
446+
"kind": 12,
447+
"tags": [],
448+
"detail": "t => t",
449+
"documentation": {"kind": "markdown", "value": "\n`toUpperCase(str)` converts `str` to upper case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\nexpand the number of letters in the result; for example the German ß\ncapitalizes to two Ses in a row.\n\nSee [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.toUpperCase(\"abc\") == \"ABC\"\nJs.String2.toUpperCase(`Straße`) == `STRASSE`\nJs.String2.toUpperCase(`πς`) == `ΠΣ`\n```\n"},
450+
"sortText": "toUpperCase",
451+
"insertText": "->Js_string2.toUpperCase",
452+
"additionalTextEdits": [{
453+
"range": {"start": {"line": 94, "character": 30}, "end": {"line": 94, "character": 31}},
454+
"newText": ""
455+
}]
456+
}]
397457

398458
Complete src/DotPipeCompletionSpec.res 97:63
399459
posCursor:[97:63] posNoWhite:[97:62] Found expr:[97:3->97:63]
@@ -410,7 +470,19 @@ ContextPath Value[Js, String2, toUpperCase]
410470
Path Js.String2.toUpperCase
411471
CPPipe pathFromEnv: found:true
412472
Path Js_string2.toLowerC
413-
[]
473+
[{
474+
"label": "->Js_string2.toLowerCase",
475+
"kind": 12,
476+
"tags": [],
477+
"detail": "t => t",
478+
"documentation": {"kind": "markdown", "value": "\n`toLowerCase(str)` converts `str` to lower case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\ngive different results depending upon context, for example with the Greek\nletter sigma, which has two different lower case forms; one when it is the last\ncharacter in a string and another when it is not.\n\nSee [`String.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.toLowerCase(\"ABC\") == \"abc\"\nJs.String2.toLowerCase(`ΣΠ`) == `σπ`\nJs.String2.toLowerCase(`ΠΣ`) == `πς`\n```\n"},
479+
"sortText": "toLowerCase",
480+
"insertText": "->Js_string2.toLowerCase",
481+
"additionalTextEdits": [{
482+
"range": {"start": {"line": 97, "character": 54}, "end": {"line": 97, "character": 55}},
483+
"newText": ""
484+
}]
485+
}]
414486

415487
Complete src/DotPipeCompletionSpec.res 101:7
416488
posCursor:[101:7] posNoWhite:[101:6] Found expr:[100:9->104:1]
@@ -433,6 +505,18 @@ Path DotPipeCompletionSpec.SomeOtherModule.
433505
"tags": [],
434506
"detail": "string",
435507
"documentation": {"kind": "markdown", "value": "```rescript\nnname: string\n```\n\n```rescript\ntype typeOutsideModule = {nname: string}\n```"}
508+
}, {
509+
"label": "->outOfScope",
510+
"kind": 12,
511+
"tags": [],
512+
"detail": "typeOutsideModule => typeOutsideModule",
513+
"documentation": null,
514+
"sortText": "outOfScope",
515+
"insertText": "->outOfScope",
516+
"additionalTextEdits": [{
517+
"range": {"start": {"line": 101, "character": 6}, "end": {"line": 101, "character": 7}},
518+
"newText": ""
519+
}]
436520
}, {
437521
"label": "->doWithTypeOutsideModule",
438522
"kind": 12,
@@ -445,6 +529,18 @@ Path DotPipeCompletionSpec.SomeOtherModule.
445529
"range": {"start": {"line": 101, "character": 6}, "end": {"line": 101, "character": 7}},
446530
"newText": ""
447531
}]
532+
}, {
533+
"label": "->cc",
534+
"kind": 12,
535+
"tags": [],
536+
"detail": "typeOutsideModule => typeOutsideModule",
537+
"documentation": null,
538+
"sortText": "cc",
539+
"insertText": "->cc",
540+
"additionalTextEdits": [{
541+
"range": {"start": {"line": 101, "character": 6}, "end": {"line": 101, "character": 7}},
542+
"newText": ""
543+
}]
448544
}, {
449545
"label": "->SomeOtherModule.getNName",
450546
"kind": 12,

0 commit comments

Comments
 (0)