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

Crashing with null language providers #18

Open
jakepurple13 opened this issue Apr 23, 2024 · 4 comments
Open

Crashing with null language providers #18

jakepurple13 opened this issue Apr 23, 2024 · 4 comments

Comments

@jakepurple13
Copy link

I'm trying to show XML but I keep running into:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Missing language for extension : 
	at com.wakaztahir.codeeditor.prettify.parser.Prettify.getLangFromExtension(Prettify.kt:137)
	at com.wakaztahir.codeeditor.prettify.parser.Prettify.getLexerForExtension(Prettify.kt:404)
	at com.wakaztahir.codeeditor.prettify.parser.Prettify$CreateSimpleLexer.decorate(Prettify.kt:792)
	at com.wakaztahir.codeeditor.prettify.PrettifyParser.parse(PrettifyParser.kt:25)
	at com.wakaztahir.codeeditor.prettify.PrettifyParser.parse(PrettifyParser.kt:21)
@wakaztahir
Copy link

wakaztahir commented Apr 23, 2024

You should use html as xml may not be supported. XML is like HTML but not supported at the moment.
Its very hard to develop a code editor or syntax highlighter that works with all languages and is small, If you are looking for something special you may have to write it.

@jakepurple13
Copy link
Author

I'm getting the same thing when I use HTML:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Missing language for extension : 
	at com.wakaztahir.codeeditor.prettify.parser.Prettify.getLangFromExtension(Prettify.kt:137)
	at com.wakaztahir.codeeditor.prettify.parser.Prettify.getLexerForExtension(Prettify.kt:404)
	at com.wakaztahir.codeeditor.prettify.parser.Prettify$CreateSimpleLexer.decorate(Prettify.kt:792)
	at com.wakaztahir.codeeditor.prettify.PrettifyParser.parse(PrettifyParser.kt:25)
	at com.wakaztahir.codeeditor.prettify.PrettifyParser.parse(PrettifyParser.kt:18)
	at com.wakaztahir.codeeditor.utils.AnnotationKt.parseCodeAsAnnotatedString(Annotation.kt:21)
	at com.wakaztahir.codeeditor.utils.AnnotationKt.parseCodeAsAnnotatedString(Annotation.kt:30)

@wakaztahir
Copy link

wakaztahir commented Apr 25, 2024

Could you please try using the Enum instead of extension, I'm pretty sure it contains HTML entry. Otherwise you can use extension default-markup

defined here

This will probably succeed.

XML extension should succeed as well. Could you try using the enum if that doesn't work, please let me know.

@jakepurple13
Copy link
Author

That is what I'm doing.

val parsedCode = remember(svgText, language) {
                            parseCodeAsAnnotatedString(
                                parser = parser,
                                theme = theme,
                                lang = CodeLang.XML,
                                code = svgText
                            )
}

And it still crashes. Even when using HTML.

@wakaztahir wakaztahir reopened this Apr 26, 2024
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