thebaselab / codeapp

Building a full-fledged code editor for iPad
https://code.thebaselab.com
MIT License
2.95k stars 202 forks source link

Spellchecking #416

Open Cogitri opened 2 years ago

Cogitri commented 2 years ago

Hello,

I currently use Code for writing my thesis on my iPad and it works very well for that. It'd be great if there was spellchecking though, to make it easier to recognise errors in my text

bummoblizard commented 2 years ago

It certainly can be implemented using iOS's native feature which works offline. Thank you for the suggestion!

luni-moon commented 2 years ago

I disagree with this suggestion. It can cause more syntax errors when writing code. For example, when writing <html>, it may autocorrect to "home". This has happened to me many times when writing code in Google Docs. If they are using this app just for writing a document, not related to programming, then it really isn't needed, as this would be an out-of-use case and they should really be using either the Notes app or a similar programme, like Google Docs.

bummoblizard commented 2 years ago

I disagree with this suggestion. It can cause more syntax errors when writing code. For example, when writing <html>, it may autocorrect to "home". This has happened to me many times when writing code in Google Docs. If they are using this app just for writing a document, not related to programming, then it really isn't needed, as this would be an out-of-use case and they should really be using either the Notes app or a similar programme, like Google Docs.

It will only be enabled on selected file types, for example markdown files. There should also be an option to disable it.

luni-moon commented 2 years ago

I disagree with this suggestion. It can cause more syntax errors when writing code. For example, when writing <html>, it may autocorrect to "home". This has happened to me many times when writing code in Google Docs. If they are using this app just for writing a document, not related to programming, then it really isn't needed, as this would be an out-of-use case and they should really be using either the Notes app or a similar programme, like Google Docs.

It will only be enabled on selected file types, for example markdown files. There should also be an option to disable it.

Now, I agree with that, as long as there is a way to even disable it for all files.

Cogitri commented 2 years ago

That should certainly be included, yes. I’m not sure if this project does issue bounties, but since I need this for my thesis I’d be willing to put a bounty on this issue to get this implemented in a timely manner, if that’s possible (unfortunately I don’t have the time to implement that parallel to my thesis, otherwise I’d do that :)

bummoblizard commented 2 years ago

That should certainly be included, yes. I’m not sure if this project does issue bounties, but since I need this for my thesis I’d be willing to put a bounty on this issue to get this implemented in a timely manner, if that’s possible (unfortunately I don’t have the time to implement that parallel to my thesis, otherwise I’d do that :)

I will implement this. (But if anyone is interested in the bounty, PR welcomed)

The idea is to implement monaco.editor.setModelMarkers and possibly monaco.langauges.registerCompletionItemProvider in Monaco Editor. The auto correction logic will be implemented natively and communicate with the editor using a message handler in WKWebView.

Threading might also be needed as the language system should not affect the UI thread.

bummoblizard commented 2 years ago

I think I can include this in the TestFlight version today.

Simulator Screen Shot - iPad Air (5th generation) - 2022-04-24 at 15 11 54

Cogitri commented 2 years ago

Great, thanks a lot for working on this :)

bummoblizard commented 2 years ago

It's available on TestFlight. You'll need to enable it from the settings menu (at the bottom).

Currently it's only enabled for .md and .txt files.

Cogitri commented 2 years ago

Nice, thanks. I’ll test the feature in a bit :)

On Sunday, Apr 24, 2022 at 3:25 PM, Ken Chung - notifications at github.com @. @.)> wrote:

It's available on TestFlight. You'll need to enable it from the settings menu (at the bottom).

Currently it's only enable for .md and .txt files.

— Reply to this email directly, view it on GitHub (https://github.com/thebaselab/codeapp/issues/416#issuecomment-1107852288), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ACC4KNKG3JJHTJJ5XDRGNG3VGVKXBANCNFSM5TG7NC3A). You are receiving this because you authored the thread.Message ID: @.***>

Cogitri commented 2 years ago

Spellchecking works for me, but I'm not quite sure how to choose a language other than English for spellchecking. I think some other apps just use the keyboard's language for spellchecking, maybe that's possible there too?

bummoblizard commented 2 years ago

Yes. It’s also possible to detect the language but I haven’t implemented it yet. Which language do you need?

On Mon, 25 Apr 2022 at 03:49, Rasmus Thomsen @.***> wrote:

Spellchecking works for me, but I'm not quite sure how to choose a language other than English for spellchecking. I think some other apps just use the keyboard's language for spellchecking, maybe that's possible there too?

— Reply to this email directly, view it on GitHub https://github.com/thebaselab/codeapp/issues/416#issuecomment-1107906619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE6T27AYGJKQX7DYRCAGZTVGWQSXANCNFSM5TG7NC3A . You are receiving this because you commented.Message ID: @.***>

Cogitri commented 2 years ago

I write my thesis in German 😄

bummoblizard commented 2 years ago

I write my thesis in German 😄

Got it. Hopefully I can add this today.

Cogitri commented 2 years ago

Grand, thank you so much!

On Monday, Apr 25, 2022 at 2:21 PM, Ken Chung - notifications at github.com @. @.)> wrote:

I write my thesis in German 😄

Got it. Hopefully I can add this today.

— Reply to this email directly, view it on GitHub (https://github.com/thebaselab/codeapp/issues/416#issuecomment-1108564351), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ACC4KNMDTNRVR5QNDMR3BWLVG2L3VANCNFSM5TG7NC3A). You are receiving this because you authored the thread.Message ID: @.***>

bummoblizard commented 2 years ago

Grand, thank you so much!

On Monday, Apr 25, 2022 at 2:21 PM, Ken Chung - notifications at github.com @. @.)> wrote:

I write my thesis in German 😄

Got it. Hopefully I can add this today.

— Reply to this email directly, view it on GitHub (https://github.com/thebaselab/codeapp/issues/416#issuecomment-1108564351), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ACC4KNMDTNRVR5QNDMR3BWLVG2L3VANCNFSM5TG7NC3A). You are receiving this because you authored the thread.Message ID: @.***>

It's on TestFlight. It detects the language using a native library. Currently it might not handle the case when there's multiple languages well. It also isn't aware of markdown syntaxes.

Cogitri commented 2 years ago

Hm, with that spellchecking does work correctly in plaintext files, but it seems like it breaks on more complex Markdown files (possibly after code blocks?)

bummoblizard commented 2 years ago

Hm, with that spellchecking does work correctly in plaintext files, but it seems like it breaks on more complex Markdown files (possibly after code blocks?)

Yep. The spell checking function should probably be syntax aware. It won't be perfect but maybe one idea is to ignore code blocks.

Cogitri commented 2 years ago

Yeah, that might work, spellchecking those probably doesn't make a ton of sense anyway