Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coc_current_function for arrow functions #344

Closed
ellioseven opened this issue Jan 16, 2022 · 3 comments
Closed

coc_current_function for arrow functions #344

ellioseven opened this issue Jan 16, 2022 · 3 comments

Comments

@ellioseven
Copy link

ellioseven commented Jan 16, 2022

I'm trying to get the current function to show on lightline, which seems to work for normal functions, but not arrow functions:

// coc_current_function: ""
const foo = () => {
  return "foo"
}

// coc_current_function: "bar"
function bar () {
  return "bar"
}

Is there some kind of configuration I'm missing?

Here is my function:

function! CocCurrentFunction()
  return get(b:, 'coc_current_function', '')
endfunction
@chemzqm
Copy link
Member

chemzqm commented Jan 16, 2022

It's expect since we only know foo is const

Result: {
    "text": "<global>",
    "kind": "script",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 9,
                "offset": 3
            }
        }
    ],
    "childItems": [
        {
            "text": "bar",
            "kind": "function",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 7,
                        "offset": 1
                    },
                    "end": {
                        "line": 9,
                        "offset": 2
                    }
                }
            ],
            "nameSpan": {
                "start": {
                    "line": 7,
                    "offset": 10
                },
                "end": {
                    "line": 7,
                    "offset": 13
                }
            }
        },
        {
            "text": "foo",
            "kind": "const",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 2,
                        "offset": 7
                    },
                    "end": {
                        "line": 4,
                        "offset": 2
                    }
                }
            ],
            "nameSpan": {
                "start": {
                    "line": 2,
                    "offset": 7
                },
                "end": {
                    "line": 2,
                    "offset": 10
                }
            }
        }
    ]
}

@chemzqm chemzqm closed this as completed Jan 16, 2022
@ellioseven
Copy link
Author

So this seems to be a response from ts-server that isn't providing the correct kind. This is an upstream issue then?

@chemzqm
Copy link
Member

chemzqm commented Jan 17, 2022

It's expected, IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants