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

Getting the line number of the end of a function definition #684

Open
hendychua opened this issue Jun 6, 2022 · 0 comments
Open

Getting the line number of the end of a function definition #684

hendychua opened this issue Jun 6, 2022 · 0 comments

Comments

@hendychua
Copy link

Hi there,

I would like to get the line number of the end of a function definition. Is there a way to do this?

To give an example, suppose the source code is:

def Foo(x): # line 1
  if x == 42:
    return True
  else:
    return False # line 5

The parsed output would return where the function definition completes, i.e. line 5.

Currently, span.end seems to point to where the symbol name definition ends but not where the whole function ends:

{
  "symbol": "Foo",
  "kind": "Function",
  "line": "def Foo(x):",
  "span": {
    "start": {
      "line": 1,
      "column": 5
    },
    "end": {
      "line": 1,
      "column": 8
    }
  },
  "nodeType": "DEFINITION"
},

Thank you.

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

1 participant