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

Code folding for markdown #4100

Closed
goyalyashpal opened this issue Jun 12, 2022 · 6 comments
Closed

Code folding for markdown #4100

goyalyashpal opened this issue Jun 12, 2022 · 6 comments

Comments

@goyalyashpal
Copy link

goyalyashpal commented Jun 12, 2022

Summary

It will be nice to have ability to fold the markdown code too

Details

The tags which can be supported:

  • # - headings tags (hashtags symbols)
  • <> ... </> - HTML tags (2 pairs of angle brackets)
    example: <details> ... </details> or the like.
  • ``` ... ``` or ~~~ ... ~~~ - code blocks (pair of triple backticks or tildes)
  • Sub-lines & subitems under a list item

Samples

  • Screen record of code folding for markdown in vscodium (using "symbols"
36kVRHQkh7.mp4

Versions:

Notepad3 (x64) v5.21.1129.1 (ba6de2c2)
Compiler: MS Visual C++ 2022 v17.0.(0-1) (VC v1930)
OS Version: Windows 10  Version 20H2 (Build 19042)
Windows Colors 'Dark-Mode' Theme is SUPPORTED and SELECTED.
Scintilla v511
Lexilla v511
Oniguruma v7.0.0
- Current Lexer -> 'Markdown'

@goyalyashpal
Copy link
Author

@RaiKoHoff
Copy link
Collaborator

Code-Folding is a thing the Lexer cares for, better to send this enhancement request to Lexilla (https://github.com/ScintillaOrg/lexilla/issues).

@goyalyashpal
Copy link
Author

goyalyashpal commented Oct 22, 2022

Code-Folding is a thing the Lexer cares for ...

Just mentioning the following for my own:

  • lexer - works at word level
  • parser - workes at "sentence" level (src)

so, is LSP different than those?

  • I was thinking that maybe the VS-Code's Markdown language server can be used
  • oh, wait, notepad3 doesn't use MS's LSP right?
  • and for obvious reasons - "ugh MS" - am i right?

As for the:

  • ~"Lexilla upstream" - sure, i'd do that (not necessarily immediately though)
  • ~"close on approval" - thanks for the info, i'd say please let it stay open for a bit more, i'll close it in some weeks myself

@RaiKoHoff
Copy link
Collaborator

Hello @yashpalgoyal1304 ,

About lexer & parser: word vs. sentence is a nice (still very simple) analogy.
A lexer tries to identify language related "tokens" (keywords, operators, numbers, strings, comments, etc.).
A parser tries to find a sensible structure, e.g. 123 + 456 -> number plus-op number -> sum -> part-of-expression.
So, a parser is based on a lexer to get a stream of tokens to build structures.
For syntax highlighting, you need mainly a lexer, since you are highlighting tokens.
Lexilla provides lexers for several programming languages (like MS's LSP).
For code-folding you need a parser to identify the structure: code-blocks. Most of Lexilla's "lexers" also have a code-block parser inside, so they are a little bit more than a simple lexer but far away from being a complete parser.
Unfortunately, Lexilla's Markdown lexer does not provide a code-block parser, so code-folding is not available for Markdown.

Notepad2 & Notepad3 are historically based on Scintilla-Library (splitted into Core-Scintilla and Lexilla-Library some years ago).
Switching Lexilla to MS' LSP would mean exchange the combustion engine of your car to an electric drive or adding an electric drive side-by-side. This does not really make sense.

Notepad3 can not and will not try to compete with VSCode (3 developers vs. 15000). Would be like comparing a leatherman multitool (NP3) vs. well equipped workshop. Notepad3 has its own place in the wide range of the tooling landscape - even it is an "classic vintage car" (in German: "Oldtimer").

And finally "no", there is no "ugh MS", all my development (work and free time) is MS based.

@goyalyashpal
Copy link
Author

Okay,

  • say i made required changes to the lexer from upstream, then what would be the steps to test those changes with notepad3 locally?
  • would i need to build notepad3 too? or can it link in some other way?

@RaiKoHoff
Copy link
Collaborator

Best would be to compile Notepad3 after integration of adapted Lexer.
You can use Visual Studio Community Edition.

@goyalyashpal goyalyashpal closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants