flow CLI autocomplete command and get-def command doesn't recognize methods and properties of an object that starts with "$" ( dollar char )
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
For example I have this piece of code on a file called `test.js`:
```javascript
// @flow
let a = {
$test: 3
}
a.AUTO332
```
If I execute `flow autocomplete --json --pretty < test.js`, it gives me only:
```json
{
"result":[
{
"name":"hasOwnProperty",
"type":"(prop: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"prop","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":50,
"endline":50,
"start":5,
"end":38
},
{
"name":"isPrototypeOf",
"type":"(o: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"o","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":51,
"endline":51,
"start":5,
"end":34
},
{
"name":"propertyIsEnumerable",
"type":"(prop: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"prop","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":52,
"endline":52,
"start":5,
"end":44
},
{
"name":"toLocaleString",
"type":"() => string",
"func_details":{"return_type":"string","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":53,
"endline":53,
"start":5,
"end":28
},
{
"name":"toString",
"type":"() => string",
"func_details":{"return_type":"string","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":54,
"endline":54,
"start":5,
"end":22
},
{
"name":"valueOf",
"type":"() => Object",
"func_details":{"return_type":"Object","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":55,
"endline":55,
"start":5,
"end":21
}
]
}
```
without the `$test` property.
If I change the property name from `$test` to `t$est` it works:
```javascript
// @flow
let a = {
t$est: 3
}
a.AUTO332
```
So, executing again `flow autocomplete --json --pretty < test.js`, it gives me:
```json
{
"result":[
{
"name":"hasOwnProperty",
"type":"(prop: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"prop","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":50,
"endline":50,
"start":5,
"end":38
},
{
"name":"isPrototypeOf",
"type":"(o: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"o","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":51,
"endline":51,
"start":5,
"end":34
},
{
"name":"propertyIsEnumerable",
"type":"(prop: any) => boolean",
"func_details":{"return_type":"boolean","params":[{"name":"prop","type":"any"}]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":52,
"endline":52,
"start":5,
"end":44
},
{
"name":"t$est",
"type":"number",
"func_details":null,
"path":"-",
"line":4,
"endline":4,
"start":10,
"end":10
},
{
"name":"toLocaleString",
"type":"() => string",
"func_details":{"return_type":"string","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":53,
"endline":53,
"start":5,
"end":28
},
{
"name":"toString",
"type":"() => string",
"func_details":{"return_type":"string","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":54,
"endline":54,
"start":5,
"end":22
},
{
"name":"valueOf",
"type":"() => Object",
"func_details":{"return_type":"Object","params":[]},
"path":"/private/tmp/flow/flowlib_32caa231/core.js",
"line":55,
"endline":55,
"start":5,
"end":21
}
]
}
```
In fact, `t$est` now is listed.
So there are problems with **methods** and **properties** that starts with "$" ( dollar char ). This problem arise also with the `get-def` command.
Instead with `type-at-pos` command, the method/property is recognized and the type is returned correctly.
Flow version: 0.66.0
Contributor guide
Assessment
This issue has not been assessed yet.