Better parsing for extracting autocomplete/hint options from source code
- Lenguaje dominante
- Haskell
- Estrellas
- 1.3k
- Forks
- 201
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
There's some existing code for finding type declarations in the current module, and augmenting the autocomplete list with them. @nixorn is extending that to his new doc-on-hover feature, as well. However, the extraction code isn't all that great right now. Specifically:
1. It only looks at one line at a time. This generates incorrect results when the type declaration is wrapped across lines.
2. It mis-parses some syntax. For example `pic1,pic2 :: Picture` will add a single item called `pic1,pic2`, when it should add separate items for both of the two pictures.
3. It would be nice to extend the parsing to recognize definition lines (like `f x = sqrt x + 1`). Type inference isn't needed here, but I think it would be great if that gave `f` an incomplete type in autocomplete and docs, like `f :: ? -> ?`. Of course, an explicit type signature should replace the incomplete definition with a complete one.
4. When extraction does succeed, it still leaves unnecessary formatting in place. So if the original source code says:
short :: Number
reallyReallyVeryVeryLong :: Number
the extracted doc for `short` will have all those spaces between `short` and `::`, even though those extra spaces aren't sensible in the new context.
One must probably resist the temptation to completely reimplement the Haskell parser in JavaScript, but I think enough special cases could go a long way.
Guía de contribución
Línea de trabajo
Locate the existing source-extraction code for type declarations and trace how its results feed autocomplete and doc-on-hover. Reproduce the multiline, comma-separated, definition-line, and spacing cases from the issue, then verify that inferred placeholders and explicit signatures appear correctly in both consumers.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- haskell, javascript
- Área
- developer-experience, documentation
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100