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

Codi typescript prompt #136

Open
jiyeol-lee opened this issue Jun 15, 2021 · 8 comments
Open

Codi typescript prompt #136

jiyeol-lee opened this issue Jun 15, 2021 · 8 comments

Comments

@jiyeol-lee
Copy link

Issue description

Codi doesn't work with typescript in specific circumstances.
What I found is that the expected 'prompt' and detected 'prompt' is not match. it does not detect 'new line (\n)' and also '}'.
I was trying to fix it but I'm not 100% sure it's happening because of this.

Here's the code

const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => {
  const restNumber = year % 400

  if (restNumber < 100) {
    return 2
  }

  if (restNumber < 200) {
    return 0
  }

  if (restNumber < 300) {
    return 5
  }

  return 3
}
getAnchorDay(2101)

Environment

  • Operating system: Mac OS Big Sur
  • Neovim v0.4.4

Log

As you can see in the log, expecting prompts is 19 but they only detect 14. Any advice to fix this?

[22:09:37.387067] <SNR>140_lo: Darwin/BSD detected, using `script -q /dev/null $bin`
[22:09:37.389110] <SNR>140_user_au[1]: Doing autocommand CodiEnterPre
[22:09:37.389932] <SNR>140_user_au[1]: Doing autocommand CodiUpdatePre
[22:09:37.390464] <SNR>140_codi_do_update[29]: Starting job for buffer 1
[22:09:37.392334] <SNR>140_codi_do_update[68]: [INPUT] const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => {�  const restNumber = year % 400��  if (restNumber < 100) {�    return 2�  }��  if (restNumber < 200) {�    return 0�  }��  if (restNumber < 300) {�    return 5�  }��  return 3�}�getAnchorDay(2101)�
��
[22:09:37.392655] <SNR>140_codi_do_update[69]: Expecting 19 prompts
[22:09:37.393148] <SNR>140_user_au[1]: Doing autocommand CodiEnterPost
[22:09:37.429287] <SNR>140_codi_handle_data[9]: [DATA] const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => {
[22:09:37.429647] <SNR>140_codi_handle_data[9]: [DATA]   const restNumber = year % 400
[22:09:37.430005] <SNR>140_codi_handle_data[9]: [DATA]   if (restNumber < 100) {
[22:09:37.430343] <SNR>140_codi_handle_data[9]: [DATA]     return 2
[22:09:37.430678] <SNR>140_codi_handle_data[9]: [DATA]   }
[22:09:37.431091] <SNR>140_codi_handle_data[9]: [DATA]   if (restNumber < 200) {
[22:09:37.431352] <SNR>140_codi_handle_data[9]: [DATA]     return 0
[22:09:37.431597] <SNR>140_codi_handle_data[9]: [DATA]   }
[22:09:37.431940] <SNR>140_codi_handle_data[9]: [DATA]   if (restNumber < 300) {
[22:09:37.432211] <SNR>140_codi_handle_data[9]: [DATA]     return 5
[22:09:37.432459] <SNR>140_codi_handle_data[9]: [DATA]   }
[22:09:37.432797] <SNR>140_codi_handle_data[9]: [DATA]   return 3
[22:09:37.433043] <SNR>140_codi_handle_data[9]: [DATA] }
[22:09:37.433292] <SNR>140_codi_handle_data[9]: [DATA] getAnchorDay(2101)
[22:09:37.692608] <SNR>140_codi_handle_data[9]: [DATA] TSUN : TypeScript Upgraded Node
[22:09:37.696299] <SNR>140_codi_handle_data[9]: [DATA] type in TypeScript expression to evaluate
[22:09:37.696682] <SNR>140_codi_handle_data[9]: [DATA] type :help for commands in repl
[22:09:37.710387] <SNR>140_codi_handle_data[9]: [DATA] > > c> co> con> cons> const> const > const g> const ge> const get> const getA> const getAn> const getAnc> const getAnch> const getAncho> const getAnchor> const getAnchorD> const getAnchorDa> const getAnchorDay> const getAnchorDay > const getAnchorDay => const getAnchorDay = > const getAnchorDay = (> const getAnchorDay = (y> const getAnchorDay = (ye> const getAnchorDay = (yea> const getAnchorDay = (year> const getAnchorDay = (year:> const getAnchorDay = (year: > const getAnchorDay = (year: n> const getAnchorDay = (year: nu> const getAnchorDay = (year: num> const getAnchorDay = (year: numb> const getAnchorDay = (year: numbe> const getAnchorDay = (year: number> const getAnchorDay = (year: number)> const getAnchorDay = (year: number):> const getAnchorDay = (year: number): > const getAnchorDay = (year: number): 2> const getAnchorDay = (year: number): 2 > const getAnchorDay = (year: number): 2 |> const getAnchorDay = (year: number): 2 | > const getAnchorDay = (year: number): 2 | 0> const getAnchorDay = (year: number): 2 | 0 > const getAnchorDay = (year: number): 2 | 0 |> const getAnchorDay = (year: number): 2 | 0 | > const getAnchorDay = (year: number): 2 | 0 | 5> const getAnchorDay = (year: number): 2 | 0 | 5 > const getAnchorDay = (year: number): 2 | 0 | 5 |> const getAnchorDay = (year: number): 2 | 0 | 5 | > const getAnchorDay = (year: number): 2 | 0 | 5 | 3> const getAnchorDay = (year: number): 2 | 0 | 5 | 3 > const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => const getAnchorDay = (year: number): 2 | 0 | 5 | 3 =>> const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => > const getAnchorDay = (year: number): 2 | 0 | 5 | 3 => {
[22:09:37.710598] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.420551] <SNR>140_codi_handle_data[9]: [DATA] .... ..  ..  c..  co..  con..  cons..  const..  const ..  const r..  const re..  const res..  const rest..  const restN..  const restNu..  const restNum..  const restNumb..  const restNumbe..  const restNumber..  const restNumber ..  const restNumber =..  const restNumber = ..  const restNumber = y..  const restNumber = ye..  const restNumber = yea..  const restNumber = year..  const restNumber = year ..  const restNumber = year %..  const restNumber = year % ..  const restNumber = year % 4..  const restNumber = year % 40..  const restNumber = year % 400
[22:09:38.420819] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.432469] <SNR>140_codi_handle_data[9]: [DATA] ..
[22:09:38.445684] <SNR>140_codi_handle_data[9]: [DATA] .... ..  ..  i..  if..  if ..  if (..  if (r..  if (re..  if (res..  if (rest..  if (restN..  if (restNu..  if (restNum..  if (restNumb..  if (restNumbe..  if (restNumber..  if (restNumber ..  if (restNumber <..  if (restNumber < ..  if (restNumber < 1..  if (restNumber < 10..  if (restNumber < 100..  if (restNumber < 100)..  if (restNumber < 100) ..  if (restNumber < 100) {
[22:09:38.445889] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.455334] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....   ....    ....    r....    re....    ret....    retu....    retur....    return....    return ....    return 2
[22:09:38.455508] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.465308] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....  }
[22:09:38.465484] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.479918] <SNR>140_codi_handle_data[9]: [DATA] ..
[22:09:38.492271] <SNR>140_codi_handle_data[9]: [DATA] .... ..  ..  i..  if..  if ..  if (..  if (r..  if (re..  if (res..  if (rest..  if (restN..  if (restNu..  if (restNum..  if (restNumb..  if (restNumbe..  if (restNumber..  if (restNumber ..  if (restNumber <..  if (restNumber < ..  if (restNumber < 2..  if (restNumber < 20..  if (restNumber < 200..  if (restNumber < 200)..  if (restNumber < 200) ..  if (restNumber < 200) {
[22:09:38.492461] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.500294] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....   ....    ....    r....    re....    ret....    retu....    retur....    return....    return ....    return 0
[22:09:38.500469] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.509176] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....  }
[22:09:38.509349] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.517315] <SNR>140_codi_handle_data[9]: [DATA] ..
[22:09:38.529393] <SNR>140_codi_handle_data[9]: [DATA] .... ..  ..  i..  if..  if ..  if (..  if (r..  if (re..  if (res..  if (rest..  if (restN..  if (restNu..  if (restNum..  if (restNumb..  if (restNumbe..  if (restNumber..  if (restNumber ..  if (restNumber <..  if (restNumber < ..  if (restNumber < 3..  if (restNumber < 30..  if (restNumber < 300..  if (restNumber < 300)..  if (restNumber < 300) ..  if (restNumber < 300) {
[22:09:38.529599] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.537812] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....   ....    ....    r....    re....    ret....    retu....    retur....    return....    return ....    return 5
[22:09:38.537995] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.547121] <SNR>140_codi_handle_data[9]: [DATA] ........ ....  ....  }
[22:09:38.547300] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.558303] <SNR>140_codi_handle_data[9]: [DATA] ..
[22:09:38.567226] <SNR>140_codi_handle_data[9]: [DATA] .... ..  ..  r..  re..  ret..  retu..  retur..  return..  return ..  return 3
[22:09:38.567433] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.576810] <SNR>140_codi_handle_data[9]: [DATA] ....}
[22:09:38.628141] <SNR>140_codi_handle_data[9]: [DATA] > > g> ge> get> getA> getAn> getAnc> getAnch> getAncho> getAnchor> getAnchorD> getAnchorDa> getAnchorDay> getAnchorDay(> getAnchorDay(2> getAnchorDay(21> getAnchorDay(210> getAnchorDay(2101> getAnchorDay(2101)
[22:09:38.628338] <SNR>140_codi_handle_data[14]: Matched prompt
[22:09:38.654008] <SNR>140_codi_handle_data[9]: [DATA] > 
[22:09:38.654303] <SNR>140_codi_handle_data[14]: Matched prompt

@nagakiran
Copy link

Noticed an issue on BigSur that whenever try to add a multi-line statement (like for loop, function definition) it starts working.
As long as all the statements are single line, it works fine. Even, it works if the arrow function is defined in a single line.
Not sure if it is related to the above issue.

@theTechGoose
Copy link

same issue

@metakirby5
Copy link
Owner

@topaxi (maintainer), if you have time can you take a look?

@topaxi
Copy link
Contributor

topaxi commented Feb 13, 2022

I'm not the maintainer of this, I was probably accidentally tagged here? 😁

@metakirby5
Copy link
Owner

@topaxi Says in the README you are 🙂
And you did submit the initial PR: #108

It's certainly not an obligation, but if you have time and are so inclined 😄

@topaxi
Copy link
Contributor

topaxi commented Feb 13, 2022

Haha, alright I see, this has been three years ago, I haven't used or done anything on here since then :)

I don't think I'll have time to look into this, sorry 😉

@theTechGoose
Copy link

theTechGoose commented Feb 13, 2022 via email

@metakirby5
Copy link
Owner

Unfortunately, I don't have any documentation specifically for contributors, since this was largely created as a personal tool.

  • The VimDoc describes all available features and options. In particular, the Output Specification section documents the "algorithm" used to select the result pane output.
  • codi.vim contains the core code. You can insert s:log calls for debugging purposes.
  • load.vim contains the default configuration.

Feel free to reach me at my email for any questions.

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

5 participants