Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 75 additions & 28 deletions README.md

Large diffs are not rendered by default.

180 changes: 163 additions & 17 deletions README/README_zh-CN.md

Large diffs are not rendered by default.

180 changes: 163 additions & 17 deletions README/README_zh-TW.md

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions docs/source/docs/Eng/ai_assistant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,25 @@ Before using the AI assistant, you need to configure it:
* - **System Prompt**
- A template that sets the AI's behavior and context

Configuration is saved to ``.jeditor/ai_config.json`` and persists between sessions.

You can also configure the API key via environment variables.
What you enter in the dialog applies to the current session. To have the settings loaded
on every launch, write them to ``.jeditor/ai_config.json`` yourself — the editor reads
that file at startup but never writes it, so your key is only ever stored where you put
it:

.. code-block:: json

{
"AI_model": {
"ai_base_url": "https://api.openai.com/v1",
"ai_api_key": "...",
"chat_model": "gpt-4",
"prompt_template": ""
}
}

``.jeditor/`` is worth adding to ``.gitignore`` so the key is never committed. Once a
model is configured, the editor exports ``OPENAI_BASE_URL``, ``OPENAI_API_KEY`` and
``CHAT_MODEL`` into the environment for the LangChain packages to pick up.

Chat Interface
---------------
Expand Down
24 changes: 21 additions & 3 deletions docs/source/docs/Eng/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,40 @@ Multi-Language
language_wrapper
^^^^^^^^^^^^^^^^^

A function that returns the translated string for a given key, based on the current language.
The single ``LanguageWrapper`` instance holding the current language and its dictionary.

.. code-block:: python

from je_editor import language_wrapper

label = language_wrapper("file_menu_label") # Returns "File" or translated equivalent
label = language_wrapper.language_word_dict.get("file_menu_label") # "File", or its translation

language_wrapper.available_languages() # ['English', 'Traditional_Chinese', ...]
language_wrapper.display_name("Japanese") # '日本語'
language_wrapper.reset_language("Japanese") # swap the dictionary

``reset_language`` only swaps the dictionary. The **Language** menu follows it with
``retranslate_ui(main_window, previous_words)``, which is what relabels the live
interface — no restart is needed.

A key a language has not translated falls back to English rather than to a blank, so a
language can be registered before its dictionary is complete:

.. code-block:: python

language_wrapper.register_language("Korean", {"file_menu_label": "파일"}, display_name="한국어")

english_word_dict / traditional_chinese_word_dict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Built-in translation dictionaries.
Built-in translation dictionaries. Simplified Chinese and Japanese are available from
their own modules.

.. code-block:: python

from je_editor import english_word_dict, traditional_chinese_word_dict
from je_editor.utils.multi_language.simplified_chinese import simplified_chinese_word_dict
from je_editor.utils.multi_language.japanese import japanese_word_dict

Plugin API
-----------
Expand Down
34 changes: 30 additions & 4 deletions docs/source/docs/Eng/code_execution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,37 @@ You can also manually select a Python interpreter from the **Python Env** menu.
Debugging
----------

Press **F9** to launch the current Python file in debug mode:
Press **F9** to launch the current Python file in debug mode. The debugger is
``python -m pdb``, driven from the editor rather than from a separate terminal.

- Python debugger (pdb) integration
- Variable inspection during execution (see Variable Inspector below)
- Step-through debugging capabilities
**Breakpoints**

``Ctrl+F9`` toggles a breakpoint on the current line, and a red dot appears in the
gutter. Breakpoints are anchored to the text, so they follow their code when lines are
inserted or removed above them. Every breakpoint in the file is sent to pdb when the
debug run starts, and toggling one during a run takes effect immediately.

**Stepping**

.. list-table::
:header-rows: 1
:widths: 30 70

* - Shortcut
- Action
* - ``Ctrl+F5``
- Continue to the next breakpoint
* - ``F10``
- Step over the current line
* - ``F11``
- Step into the call on the current line
* - ``Shift+F11``
- Step out of the current function

The same commands are on the **Run > Debug** menu, and anything pdb understands can be
typed directly into the debugger input.

Variable inspection during execution is covered by the Variable Inspector below.

Stop Execution
^^^^^^^^^^^^^^^
Expand Down
56 changes: 56 additions & 0 deletions docs/source/docs/Eng/code_quality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ to conform to the Google style guide.
- Applies consistent indentation, spacing, and line breaks
- Available from the **Check Code Style** menu

**Format on Save:**

YAPF can also run every time a file is saved, keeping the caret on its line. Source that
cannot be parsed is left alone rather than blocking the save.

PEP 8 Checking
----------------

Expand All @@ -36,6 +41,30 @@ in the background:
- Comprehensive Python linting rules covering hundreds of checks
- Results are reported without blocking your workflow

The **buffer** is checked, not the file on disk, so unsaved edits are covered, and a
stale result from a superseded run is discarded. If ``ruff`` is not installed, or a run
fails, the editor simply shows no diagnostics rather than reporting an error.

Problems Panel
---------------

Every diagnostic — from ruff for Python, and from the language server for other
languages — is underlined in the editor and listed in the Problems dock panel with its
rule, message and line. Double-click a row to jump to it.

Test Panel
-----------

Run pytest from a dock panel and read the results, failures first, with the summary as
the status line:

- Run everything, only the selection, or only what failed last time
- Selecting a failure shows its traceback in a pane below the list
- Double-click a row to open that test at the failing line
- A coverage box adds the total beside the summary, which needs ``pytest-cov`` installed
in the project being tested
- The run happens in a background process, so the editor stays usable

JSON Reformatting
------------------

Expand All @@ -45,3 +74,30 @@ JEditor can format and validate JSON files:
- Pretty-prints JSON with proper indentation
- Validates JSON syntax and reports errors
- Available from the **Check Code Style** menu

Text Transforms
----------------

The **Text** menu applies whole-document or selection-wide edits, each as a single undo
step:

- **Trim Trailing Whitespace** — strip trailing whitespace from every line, preserving
the caret position
- **Convert Indentation** — convert leading indentation between tabs and spaces, using
the configured indent size. Only leading whitespace is touched, so tabs and spaces
inside strings are never altered
- **Case conversion** — upper, lower, swap or title case
- **Naming style** — ``snake_case`` / ``camelCase`` / ``PascalCase`` / ``kebab-case``
- **Number base** — hex, decimal and binary
- **Encode / decode** — Base64, URL, HTML entities and JSON string escaping. A decoder
that fails leaves the text untouched
- **Line operations** — natural sort, remove duplicate lines, remove blank lines, reverse
line order, or align lines on a delimiter such as ``=``
- **Statistics** — line, word and character counts for the document or the selection

Indent Size
------------

Tab-indent, unindent and ``Enter`` auto-indent all honour the configured indent size
(**Text > Indent Size**), and the indent width is auto-detected from a file's own content
when it is opened.
116 changes: 86 additions & 30 deletions docs/source/docs/Eng/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,37 @@ The main settings file controls editor behavior and appearance:

* - Setting
- Description
* - ``ui_font_family``
* - ``ui_font``
- Font family for the main UI (menus, panels, dialogs)
* - ``ui_font_size``
- Font size for the main UI
* - ``editor_font_family``
* - ``font``
- Font family for the code editor
* - ``editor_font_size``
* - ``font_size``
- Font size for the code editor
* - ``language``
- UI language (``English``, ``Traditional Chinese``, or plugin-provided)
* - ``theme``
- UI theme style (dark or light material themes)
- UI language (``English``, ``Traditional Chinese``, ``Simplified Chinese``,
``Japanese``, or plugin-provided). Taken from the system locale on a first run.
* - ``ui_style``
- UI theme style file, e.g. ``dark_amber.xml``
* - ``encoding``
- Default file encoding (``UTF-8``, ``GBK``, ``Latin-1``)
* - ``last_open_file``
- Default file encoding (``utf-8``, ``GBK``, ``latin-1``)
* - ``last_file``
- Path to the last opened file (restored on launch)
* - ``python_compiler``
- Path to the Python interpreter for code execution
* - ``max_output_lines``
* - ``max_line_of_output``
- Maximum lines in the output panel (default: 200,000)
* - ``recent_files``
- List of recently opened files
* - ``indent_size``
- Indentation size in spaces (default: 4)
* - ``open_files``
- The tabs that were open at the last shutdown
* - ``restore_session``
- Whether to reopen those tabs on launch (default: ``true``)
* - ``shortcuts``
- Keys the user reassigned; only what differs from a default is stored

user_color_setting.json
^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -55,19 +62,38 @@ Controls the color scheme for the editor and output:
* - Setting
- Description
* - ``line_number_color``
- RGB color for line number text
* - ``line_number_bg_color``
- RGB color for the line number gutter background
- Line number text
* - ``line_number_background_color``
- Line number gutter background
* - ``current_line_color``
- RGB color for the current line highlight
* - ``normal_output_color``
- RGB color for normal output text
* - ``error_output_color``
- RGB color for error output text
* - ``warning_output_color``
- RGB color for warning output text

All colors are specified as RGB arrays, e.g., ``[255, 0, 0]`` for red.
- Current line highlight
* - ``normal_output_color`` / ``error_output_color`` / ``warning_output_color``
- Output panel text
* - ``syntax_keyword_color`` / ``syntax_string_color`` /
``syntax_comment_color`` / ``syntax_number_color``
- Syntax highlighting
* - ``diff_added_marker_color`` / ``diff_modified_marker_color`` /
``diff_removed_marker_color``
- Git change markers in the gutter
* - ``blame_annotation_color``
- Inline blame text
* - ``lint_underline_color``
- Underline under a lint diagnostic
* - ``bookmark_marker_color`` / ``fold_marker_color`` /
``breakpoint_marker_color``
- Gutter markers
* - ``occurrence_highlight_color``
- Other occurrences of the word under the caret
* - ``extra_cursor_color``
- Additional carets
* - ``indent_guide_color`` / ``trailing_whitespace_color``
- Indent guides and trailing whitespace shading
* - ``minimap_background_color`` / ``minimap_line_color`` /
``minimap_viewport_color``
- Minimap

All colors are specified as RGB arrays, e.g., ``[255, 0, 0]`` for red. Any key left out
falls back to the current theme's value, so a partial file is fine.

ai_config.json
^^^^^^^^^^^^^^^
Expand All @@ -79,14 +105,19 @@ AI assistant configuration (see :doc:`ai_assistant` for details):
- Model name
- System prompt template

Unlike the two files above, this one is read but never written — create it yourself if
you want the settings loaded on every launch.

Theming
--------

JEditor supports dark and light themes via `qt-material <https://github.com/UN-GCPDS/qt-material>`_:

- **Default:** Dark Amber theme
- Switch themes from the **UI Style** menu
- Theme changes may require an application restart to fully take effect
- The editor's own colors follow the window style: switching to a light theme moves the
gutter, current-line and syntax colors to a light set. A color you picked yourself is
left alone — only those still at a default follow the theme

Font Customization
-------------------
Expand Down Expand Up @@ -114,9 +145,13 @@ JEditor's UI is built with Qt's dock widget system, making panels rearrangeable:
- **File Tree** — Project directory browser
- **Console** — Shell / IPython console
- **AI Chat** — AI assistant panel
- **Git** — Git client panel
- **Git** — Git client panel, branch tree and diff viewer
- **Browser** — Built-in web browser
- **Variable Inspector** — Runtime variable debugging
- **Problems** — Lint and language-server diagnostics
- **Outline** — Classes, functions and variables in the current file
- **Tests** — pytest results, failures and coverage
- **TODO** — ``TODO`` / ``FIXME`` / ``HACK`` comments found across the project

All panels can be:

Expand All @@ -137,16 +172,37 @@ JEditor supports system tray integration:
Multi-Language UI
------------------

JEditor supports multiple UI languages:

**Built-in Languages:**

- English (default)
- English
- Traditional Chinese (繁體中文)
- Simplified Chinese (简体中文)
- Japanese (日本語)

**Adding Languages via Plugins:**
Each is complete. Simplified Chinese is written in mainland vocabulary rather than
converted from the traditional text, where 檔案/文件, 資料夾/文件夹 and 程式/程序 all
differ.

**Following the System:**

On a first run the language is taken from the system locale rather than defaulting to
English. Chinese is resolved by script: ``zh-Hant`` and the Taiwan, Hong Kong and Macau
regions get traditional characters, anything else simplified. What was detected is
written to ``user_setting.json``, so from then on it is simply the chosen language.

Additional languages can be added through the plugin system (see :doc:`plugins`).
Language changes take effect after restarting the application.
**Switching:**

Pick a language from the **Language** menu. No restart is needed — the menus, toolbar,
panels, tabs and status bar are relabelled at once. File and branch names shown on tabs
are left alone.

**Fallback:**

A key a language has not translated shows the English text rather than a blank label, so
a language can be added before it is finished.

**Adding Languages via Plugins:**

Switch languages from the **Language** menu.
Additional languages can be added through the plugin system (see :doc:`plugins`). Locale
rules for Korean, Spanish, French, German, Russian and Portuguese are already in place;
each needs only its dictionary.
Loading
Loading