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

Cannot read properties of undefined (reading 'length') #216

Open
michaelboyles opened this issue Jun 17, 2024 · 0 comments Β· May be fixed by #217
Open

Cannot read properties of undefined (reading 'length') #216

michaelboyles opened this issue Jun 17, 2024 · 0 comments Β· May be fixed by #217
Labels
πŸ› bug Defect / Bug

Comments

@michaelboyles
Copy link
Contributor

michaelboyles commented Jun 17, 2024

πŸ‘“ What did you see?

This line:

character: lines[line].length,

can throw an uncaught exception in some circumstances

βœ… What did you expect to see?

No exception

πŸ“¦ Which tool/library version are you using?

Cucumber lang service 1.6.0

πŸ”¬ How could we reproduce it?

Go to live demo https://cucumber.github.io/monaco/

Delete the table. Now start a new doc string with 3 quotes. Your editor content will now be

@foo
Feature: Hello
Scenario: Hi
  Given I have 58 cukes in my belly
  And this is an undefined step
    """

Check the console. It contains this error

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at t.getGherkinDiagnostics (getGherkinDiagnostics.js:67:52)
    at configureMonaco.js:96:58
    at configureMonaco.js:105:17

πŸ“š Any additional context?

It seems like Monaco gives a line number 1 higher than the actual number of lines, in the case of EOF issues. So when indexing into lines, the result is undefined.

@michaelboyles michaelboyles linked a pull request Jun 17, 2024 that will close this issue
7 tasks
@kieran-ryan kieran-ryan added the πŸ› bug Defect / Bug label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ› bug Defect / Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants