completion #82

Open
opened 2023-02-13 04:59:37 +00:00 by utopiah · 5 comments
Owner

for example

  1. get document source, e.g x=new XMLSerializer().serializeToString(document)
  2. tokenize it (bit more complex than just split(), might need e.g nlp_compromise)
  3. de-deplicate tokens
  4. sort aphabetically
  5. return matches

optionally

  • rank or limit by
    • frequency
    • scope e.g <script> tag
      • semantically meaningful scope, e.g current function
    • spatially, e.g limit to volume boundary, e.g .5m sphere
  • UX : test with
    • function e.g complete_partial_token(partial_token) then
    • keyboard shortcut e.g Ctrl-n then
    • gesture shortcut e.g pull end of token to right
for example 1. get document source, e.g `x=new XMLSerializer().serializeToString(document)` 1. tokenize it (bit more complex than just `split()`, might need e.g nlp_compromise) 1. de-deplicate tokens 1. sort aphabetically 1. return matches optionally * rank or limit by * frequency * scope e.g `<script>` tag * semantically meaningful scope, e.g current function * spatially, e.g limit to volume boundary, e.g .5m sphere * UX : test with * function e.g `complete_partial_token(partial_token)` then * keyboard shortcut e.g Ctrl-n then * gesture shortcut e.g pull end of token to right
Author
Owner

example of introspection with some filtering

for ( var i in window ) {
    if (typeof window[i] == "function" && i.length>2) console.log(i, typeof window[i], window[i]);
}

from https://stackoverflow.com/questions/2051678/getting-all-variables-in-scope/2052434#2052434

example of introspection with some filtering ```javascript for ( var i in window ) { if (typeof window[i] == "function" && i.length>2) console.log(i, typeof window[i], window[i]); } ``` from https://stackoverflow.com/questions/2051678/getting-all-variables-in-scope/2052434#2052434
Author
Owner
could also rely on https://esprima.org for AST or even completion https://github.com/espadrine/aulx especially https://github.com/espadrine/aulx/blob/master/js/sandbox.js (related discussion https://twitter.com/utopiah/status/1625053344736636929 )
Author
Owner

see also https://github.com/JunoLab/FuzzyCompletions.jl relying on levenshtein distance to be more flexible and the idea of expanding it including via hooks https://github.com/JuliaLang/julia/issues/44287

see also https://github.com/JunoLab/FuzzyCompletions.jl relying on levenshtein distance to be more flexible and the idea of expanding it including via hooks https://github.com/JuliaLang/julia/issues/44287
Author
Owner

should be done for JS first...

should be done for JS first...
utopiah reopened this issue 2023-02-19 05:17:56 +00:00
Author
Owner

... but also for dxr and potentially any language with its notation system.

see #58 principle

... but also for `dxr` and potentially any language with its notation system. see https://git.benetou.fr/utopiah/text-code-xr-engine/issues/58 principle
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: utopiah/text-code-xr-engine#82