Skip to content

Conversation

@karlduderstadt
Copy link
Contributor

@karlduderstadt karlduderstadt commented Jul 29, 2022

When this language was named Python, syntax highlighting was supported directly using the default python highlighter available in rsyntaxtextarea. The name change to Python (Jython) disrupts this support. To add back syntax highlighting support for the new name, this PR adds two dependencies:

  • org.scijava:script-editor
  • com.fifesoft:rsyntaxtextarea

Also this bumps the pom to version 32.0.0-beta-4 (not required, but I did it). the new class JythonScriptSyntaxHighlighter is added that adds the language name python-(jython) for syntax highlighting using the PythonTokenMaker.

I guess the added dependencies are not ideal, especially the rsyntaxtextarea. I guess there could be other hacky solutions like the current implementation that changes the names so the default highlighters work...

Changes to autocompletion were also required as a result of this name change. They can be found in this PR scijava/script-editor-jython#17.

What should be do?

bump pom to 32.0.0-beta-4
add org.scijava:script-editor
add com.fifesoft:rsyntaxtextarea
@ctrueden
Copy link
Member

ctrueden commented Jul 29, 2022

Thank you @karlduderstadt for working on this! 👍

I agree that the new dependencies are not ideal. We have to be really careful to avoid the various SciJava script component libraries from becoming a tangled mess. In particular, any scripting-* library depending on script-editor is upside-down. We might need to split up script-editor into multiple component libraries to avoid headaches later.

I have added this PR to my PR shortlist and will hopefully have time to think in detail during my next PR review day (Wednesdays) and propose and/or implement a solution.

@karlduderstadt
Copy link
Contributor Author

karlduderstadt commented Jul 30, 2022

Thanks for the very fast feedback! Yes, I was also thinking that. It makes sense to avoid adding these extra dependencies.

Before I forget, a proposal. What if we just added the highlighter directly to org.scijava.ui.swing.script.highliters. This would keep things nicely organized as they are and require no dependency changes. Also, it is innocuous if the new language isn't discovered.

Assuming you agree with this plan, I would also move the highlighter currently in scripting-python directly to org.scijava.ui.swing.script.highliters and remove the dependencies over there as well.

@ctrueden ctrueden self-assigned this Jul 31, 2022
@imagesc-bot
Copy link

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/python-syntax-highlighting-stopped-working-in-fiji-script-editor/83615/3

@ctrueden
Copy link
Member

I migrated this work to script-editor-jython where it fits better architecturally; see scijava/script-editor-jython@05d9d40.

@ctrueden ctrueden closed this Jan 19, 2024
@ctrueden ctrueden deleted the support_python_(jython)_rename_syntax_highlighting branch January 19, 2024 20:56
@imagesc-bot
Copy link

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/python-syntax-highlighting-stopped-working-in-fiji-script-editor/83615/19

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

Successfully merging this pull request may close these issues.

4 participants