Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt at tab completion for inferior fsharp
This is a start at implementing tab completion for inferior fsharp buffers through comint-redirect style process filters. The completion process is as follows: When inferior-fsharp-get-completion is triggered, we copy the input at the inferior fsharp prompt and clear the input. We then set up redirection of the inferior processes output via comint-redirect-setup, and set up a proess filter to check the output for our completion. Once we get output that looks like a completion, we grab it, send (length completion) backspaces to the inferior process to clear it's input buffer, remove our process filter, undo our redirection setup, return our completion back to the function that requested it, and insert it in the inferior fsharp prompt line. This is pretty awkward feeling due to needing to manage our buffer's prompt and fsi's input buffer seperately, hopefully that's not entirely unavoidable. Right now, this lacks a few things needed as a bare minimum to be acceptable, imo: + it currently assumes a completion will always be returned (easy to fix) + it needs to call (sleep-for) to ensure our output filters aren't deactivated before all the output from fsi has been received + it will only ever give the first completion -- the way fsi does it is to return subsequent members of completions on subsequent tab presses, we don't have a mechanism for handling this yet. The first point can probably be fixed just by looking for a bell in output or using a timeout, but the second two will require a more fleshed out solution for process/buffer communication. Need to read python-shell-completion-native and probably some other inferior-repl modes completion implementations for guidance. We also need to figure out how to write tests for this and write them before going much further here.
- Loading branch information