bjones1 / CodeChat_Editor

The CodeChat Editor provides an easy-to-use literate programming environment
Other
6 stars 7 forks source link

CodeChat Editor overview

The CodeChat Editor is a GUI-based programmer's word processor / Jupyter for software developers. This document records its overall design.

How to run

The CodeChat Editor repository contains the code for this application. Either download the latest release or (better) build from source.

To build from source

  1. Clone or download the repository.
  2. Install the Rust language. I recommend the 64-bit toolset for Windows.
  3. Install NPM (the Node.js package manager).
  4. Install all NPM dependencies: in the client/ directory, run npm update.
  5. Package all JavaScript dependencies from NPM: also in the client/ directory, run npm run build.
  6. In the server/ directory, execute cargo run.
  7. Open http://localhost:8080 in your browser.
  8. Open the file README.md.

Vision

These form a set of high-level requirements to guide the project.

Nice to have features

Requirements

The requirements expand on the vision by providing additional details.

Code blocks and doc blocks

Comments in most programming languages are either inline comments (which are terminated by a newline) or block comments, which may span multiple lines. In C/C++, the opening delimiter for an inline comment is //. Likewise, /* and */ define the opening and closing delimiters for block comments.

This design treats source code on a line-by-line basis. It does not classify at any deeper granularity -- for example, it does not support a mix of code block and doc block on the same line.

A code block consists of all lines in a source file which aren't classified as a doc block. Note that code blocks may consist entirely of a comment, as illustrated below.

A doc block consists of a comment (inline or block) optionally preceded by whitespace and optionally succeeded by whitespace. At least one whitespace character must separate the opening comment delimiter from the doc block text. Some examples in C:

void foo(); // This is not a doc block, because these comments are preceded
void bar(); // by non-whitespace characters. Instead, they're a code block.
//This is not a doc block, because these inline comments lack
//whitespace after the opening comment delimiter //. They're also a code block.
/*This is not a doc block, because this block comment lacks
whitespace after the opening comment delimiter /*. It's also a code block. */
/* This is not a doc block, because non-whitespace
characters follow the closing comment delimiter.
It's also a code block. */ void food();

// This is a doc block. It has no whitespace preceding the inline
// comment delimiters and one character of whitespace following it.
// This is also a doc block. It has two characters of whitespace
// preceding the comment delimiters and one character of whitespace following it.
/* This is a doc block. Because it's based on
a block comment, a single comment can span multiple lines. */
/* This is also a doc block, even without the visual alignment
or a whitespace before the closing comment delimiter.*/
/* This is a doc block
as well. */

Doc blocks are differentiated by their indent: the whitespace characters preceding the opening comment delimiter. Adjacent doc blocks with identical indents are combined into a single, larger doc block.

// This is all one doc block, since only the preceding
// whitespace (there is none) matters, not the amount of
// whitespace following the opening comment delimiters.
// This is the beginning of a different doc
// block, since the indent is different.
// Here's a third doc block; inline and block comments
/* combine as long as the whitespace preceding the comment
delimiters is identical. Whitespace inside the comment doesn't affect
the classification. */
// These are two separate doc blocks,
void foo();
// since they are separated by a code block.

Programming language support

Initial targets come from the Stack Overflow Developer Survey 2022's section on programming, scripting, and markup languages and IEEE Spectrum's Top Programming Languages 2022.

IDE/text editor integration

Initial targets come from the Stack Overflow Developer Survey 2022's section on integrated development environments.

There are two basic approaches:

Additional features:

Zero-build support

The "build" should occur immediately (to any open files) or when when saving a file (to closed files, which will be updated when they're next opened). Exception: edits to the TOC are applied only after a save.

Authoring support

This system should support custom tags to simplify the authoring process. The GUI must indicate that text enclosed by the tags isn't directly editable, instead providing an option to edit the underlying tag that produced the text. When a new tag is inserted, any tag-produced content should be immediately added.

License

Copyright (C) 2022 Bryan A. Jones.

This file is part of the CodeChat Editor.

The CodeChat Editor is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The CodeChat Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the CodeChat Editor. If not, see https://www.gnu.org/licenses/.