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

[Feature Request] Java and Scala support #92

Open
bynux-gh opened this issue Jul 26, 2018 · 4 comments
Open

[Feature Request] Java and Scala support #92

bynux-gh opened this issue Jul 26, 2018 · 4 comments

Comments

@bynux-gh
Copy link

With Java being one of the most ubiquitous languages in use, and Scala one of its best alternatives, support for these languages would be an extremely useful feature. Both languages have built-in REPL tools (jshell with Java 8+, and the scala command for Scala).

I'll take a look into the Vimscript and submit a pull request if I can get either language working.

@metakirby5
Copy link
Owner

Thanks for offering to take a look :) This section in the docs should be helpful to look at. Let me know if you have any questions!

@bynux-gh
Copy link
Author

bynux-gh commented Jul 27, 2018

I've put together the interpreters how I'd expect them to work, but based on g:codi#log it seems the REPLs for both Scala and Java are running too slowly to show a prompt, let alone return any values.

Here's an example of results I'm getting from the log. Maybe an extra pair of eyes could parse through it and figure out what I'm doing wrong, or if jshell and scala are just weird somehow.

I do notice a spike in CPU usage when typing while Codi is on, and the logs confirm that something's happening behind the scenes. I'm wondering if they need preprocessor functions or something, but the logs make it look like the interpreters are just "giving up" before anything meaningful can be returned.

It may also be a problem with my machine, though I'm running an upper-mid-tier processor.

The code I added:

" From codi.vim/autoload/codi/load.vim - starting at Line 179
"      \ 'julia': {
"         \ 'bin': ['julia', '-qi', '--color=no', '--history-file=no'],
"         \ 'prompt': '\(julia> \)',
"         \ 'preprocess': function('s:pp_remove_esc'),
"         \ },
       \ 'java': {
          \ 'bin': 'jshell',
          \ 'prompt': '\(jshell> \)',
          \ },
       \ 'scala': {
" Remove color from prompt to avoid ANSI escape codes.
          \ 'bin': ['scala', '-Dscala.color=false'], 
          \ 'prompt': '\(jshell> \)',
       \ },
    \ }
"function! codi#load#interpreters()
" return s:deep_extend(s:codi_default_interpreters, g:codi#interpreters)
"endfunction
"...

@metakirby5
Copy link
Owner

Not sure what's wrong with jshell - it seems that the executable is just not giving us the rest of the output we want. For scala however, you just have the wrong prompt; replace it with ^scala> . The output is not formatted correctly for consumption, so some work will have to be done there.

@bynux-gh
Copy link
Author

For scala however, you just have the wrong prompt...

Oh...right. 😅

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

2 participants