Provide basic source code editor features in VisualEditor SyntaxHighlight plugin
OpenPublic

Description

Author: suitongbowgn

Description:
Feature request:

A feature that supports insertion and simple editing of source code snippets in a general article. It may include a simple grammar checking mechanism which checks some fundamental grammatical errors such as having a { without closing it, having a () with a trailing period and nothing else, having solely a pair of brackets, etc.; an indentation correction tool which will perform indentation formatting on the codes; a beautify code tool which will reorganize code formatting, including indentation to make the code more reader-friendly in format.

Features:

  • Insert or edit a code block.
  • Basic IDE features (perhaps re-use WikiEditor/CodeEditor)
    • Syntax validation (matching quotes/parenthesis/braces etc.)
    • Follow indentation level when breaking lines.
    • Live grammar highlighting.
bzimport added a project: SyntaxHighlight.Via ConduitNov 22 2014, 1:44 AM
bzimport set Reference to bz47742.
bzimport created this task.Via LegacyApr 26 2013, 5:41 PM
matmarex added a comment.Via ConduitApr 26 2013, 5:49 PM
  • This bug has been marked as a duplicate of bug 43133 ***
bzimport added a comment.Via ConduitApr 26 2013, 5:54 PM

suitongbowgn wrote:

I believe that request is too broad and this one is more specific. (In reply to comment #1)

> *** This bug has been marked as a duplicate of bug 43133 ***

matmarex added a comment.Via ConduitApr 26 2013, 6:14 PM

If anything, it seems like this request would build on top of that one. It's currently just not possible to edit almost anything else than plaintext in VisualEditor (and it's not just an interface issue, but a backend one as well).

I'm reopening and marking as dependent on that one, then. Feel free to adjust this :)

GWicke added a comment.Via ConduitApr 26 2013, 6:15 PM

Making sure that arbitrary wikitext does not interact with other parts of the page is difficult. It is possible to enforce this for extension content, but generally not for arbitrary parts of a page.

matmarex added a comment.Via ConduitApr 26 2013, 6:16 PM

Ah, it seems I misunderstood, sorry. I though you are talking about the source code *of the article itself*, and it appears like you meant source code in different languages, such as what's included in a <syntaxhighlight> tag.

Sorry and please disregard my comments :)

bzimport added a comment.Via ConduitApr 26 2013, 6:29 PM

suitongbowgn wrote:

I understand that the rich text is just a presentation and I can see in article source that the formats are defined using a set of markups. What I'm proposing is a plugin/feature which will take care of write the markup(plaintext) for the user when editing code snippets, just like what VisualEditor is intended to do (in my opinion). In addition source code needs special formatting that is different from natural written human language, so that's why I think the feature should include automatic indentation and such.
For editing just a part of the text, I'm thinking of an interface similar to a pop-up window, obscuring parts of the editing window. Just like when you insert an image the editor will have a new window pop up asking image url, alt text, target, etc. When you click insert the editor will convert your choice in that pop-up window to the plaintext with tags and other markups, which will be visually reflected in the main WYSIWYG editor.

(In reply to comment #5)

Ah, it seems I misunderstood, sorry. I though you are talking about the
source
code *of the article itself*, and it appears like you meant source code in
different languages, such as what's included in a <syntaxhighlight> tag.

Sorry and please disregard my comments :)

(In reply to comment #4)

Making sure that arbitrary wikitext does not interact with other parts of the
page is difficult. It is possible to enforce this for extension content, but
generally not for arbitrary parts of a page.

Jdforrester-WMF added a comment.Via ConduitApr 26 2013, 7:02 PM

Given that this is about desired enhancements to a VisualEditor plugin for the SyntaxHighlight extension - bug 43126 - moving this there and marking as a dependency.

bzimport added a comment.Via ConduitApr 28 2013, 5:12 PM

suitongbowgn wrote:

In a nutshell it would be a major front-end JS work and will leave backend as-is as much as possible. I'm pretty sure that it will only utilize tags currently available and won't affect backend at all.(In reply to comment #6)

Qgil added a comment.Via ConduitMay 2 2013, 10:39 PM

Just a note to say that Tongbo Sui has submitted a GSoC proposal related to this report: https://www.mediawiki.org/wiki/User:Beanixster

Good luck!

gerritbot added a comment.Via ConduitJun 14 2013, 6:09 AM

Related URL: https://gerrit.wikimedia.org/r/68615 (Gerrit Change I4adede9e05fd2236cee50ce03f597e8ff6b1914d)

bzimport added a comment.Via ConduitJul 30 2013, 5:38 AM

suitongbowgn wrote:

Somebody with the power could you change the bug status to assigned, and it was assigned to me.
Also anyone who is interested please feel free to give code review at the following patch.

Related URL: https://gerrit.wikimedia.org/r/68615 (Gerrit Change
I4adede9e05fd2236cee50ce03f597e8ff6b1914d)

gerritbot added a comment.Via ConduitJul 30 2013, 5:43 AM

Change 68615 had a related patch set uploaded by Jforrester:
Source code editing

https://gerrit.wikimedia.org/r/68615

Mattflaschen added a comment.Via ConduitJul 30 2013, 5:47 AM

If you don't have permission to do it yourself, it's probably because you don't have the 'editbugs' right. Hopefully, someone on this bug can give it you. If not, ask on IRC.

Krenair added a comment.Via ConduitJul 30 2013, 3:06 PM

CCing Andre who can give you editbugs.

Esanders added a comment.Via ConduitSep 6 2013, 11:11 PM

Tongbo: Re: your implmementation so far: Is the language spec something you've come up with yourself? Have you considered using an existing highlighter library, or at least basing your implementation on a existing language spec format (e.g. implementing GeSHi language specs in JS?)

bzimport added a comment.Via ConduitSep 6 2013, 11:23 PM

suitongbowgn wrote:

The highlighter spec is ported from GeSHi's php into js. I didn't find spec for validator so I came up with myself.

(In reply to comment #15)

Tongbo: Re: your implmementation so far: Is the language spec something
you've
come up with yourself? Have you considered using an existing highlighter
library, or at least basing your implementation on a existing language spec
format (e.g. implementing GeSHi language specs in JS?)

Mattflaschen added a comment.Via ConduitSep 9 2013, 10:19 PM

(In reply to comment #15)

Have you considered using an existing highlighter
library, or at least basing your implementation on a existing language spec
format (e.g. implementing GeSHi language specs in JS?)

GeSHi is GPLv2+, whereas VisualEditor is MIT. So if any GeSHi code is reused, the authorship and licensing should be made clear.

bzimport added a comment.Via ConduitSep 9 2013, 10:27 PM

suitongbowgn wrote:

For now no codes from GeSHi are directly reused. I just used them as reference for regex patterns. I said 'port' due to this fact.

(In reply to comment #17)

(In reply to comment #15)
> Have you considered using an existing highlighter
> library, or at least basing your implementation on a existing language spec
> format (e.g. implementing GeSHi language specs in JS?)

GeSHi is GPLv2+, whereas VisualEditor is MIT. So if any GeSHi code is
reused,
the authorship and licensing should be made clear.

Qgil added a comment.Via ConduitSep 17 2013, 4:23 PM

GSoC "soft pencils down" date was yesterday and all coding must stop on 23 September. Has this project been completed?

bzimport added a comment.Via ConduitSep 18 2013, 4:17 PM

suitongbowgn wrote:

Yes.

(In reply to comment #19)

GSoC "soft pencils down" date was yesterday and all coding must stop on 23
September. Has this project been completed?

Jdforrester-WMF added a comment.Via ConduitOct 2 2013, 6:51 PM

Marking this also as fixed by gerrit 68615 - congratulations again!

Jdforrester-WMF added a comment.Via ConduitJul 7 2014, 6:36 PM

Re-opening as this is now unmerged.

gerritbot added a comment.Via ConduitJul 7 2014, 6:37 PM

Change 114529 had a related patch set uploaded by Jforrester:
[WIP] Add VisualEditor support

https://gerrit.wikimedia.org/r/114529

Sunpriat added a subscriber: Sunpriat.Via WebJan 28 2015, 7:27 AM
Jdforrester-WMF lowered the priority of this task from "Normal" to "Lowest".Via WebMay 29 2015, 2:28 PM
Jdforrester-WMF removed a project: Patch-For-Review.
Jdforrester-WMF set Security to None.
Krinkle changed the title from "Support simple source code editing tools for the VisualEditor plugin for the SyntaxHighlight extension" to "Provide basic source code editor features in VisualEditor SyntaxHighlight plugin".Via WebJun 26 2015, 8:41 AM
Krinkle edited the task description. (Show Details)
Restricted Application added a project: VisualEditor. · View Herald TranscriptVia HeraldJun 26 2015, 8:41 AM
Jdforrester-WMF moved this task to Backlog on the VisualEditor workboard.Via WebJun 29 2015, 6:28 PM
Ricordisamoa added a subscriber: Ricordisamoa.Via WebMon, Jul 6, 7:54 PM

Add Comment