Skip to content

Conversation

@bratorange
Copy link

See #1744 for more details

bratorange added 9 commits May 8, 2025 21:52
…nOptions class

- Revised PLUGIN_DEV_NOTES to reflect the current status and next steps for the Tinymist language server integration, including completion of Phase 1 and Phase 2.
- Introduced TinymistInitializationOptions class to structure initialization options for the language server, mirroring VSCode configuration.
- Enhanced TinymistLspStreamConnectionProvider to utilize the new initialization options structure.
…ionality

- Introduced a new development notes file detailing the project scope, current status, next steps, and identified technical debt for the Tinymist IntelliJ plugin.
- Implemented TypstPreviewFileEditor and TypstTextEditorWithPreviewProvider to enable a split view for Typst files, integrating a JCEF-based preview panel.
- Updated plugin.xml to register the new preview editor and removed the previously planned tool window for Typst preview.
- Cleaned up unused code in TypstLexerAdapter and ensured proper handling of the preview functionality.
@bratorange
Copy link
Author

okay it seems as some slop wasnt cleaned up before. I gone take care of that

…impl dependency; doesnt build yet

- Added an explicit dependency on `platform-impl` in the build configuration to ensure proper functionality.
- Updated `TypstPreviewFileEditor` to improve the loading of the preview page with local assets, including a JavaScript bridge for communication between the IntelliJ plugin and the preview content.
- Enhanced error handling and logging for better debugging during the preview loading process.
- Cleaned up development notes to reflect the current state and future plans for the Typst integration.
…components

- Updated `TypstPreviewFileEditor` to directly load the Tinymist preview server URL, enhancing the integration with the background preview functionality.
- Removed the `TypstPreviewResourceHandler` and related resource handling code, as the preview server now serves all necessary assets.
- Cleaned up the `TinymistLspStreamConnectionProvider` to streamline initialization options and command execution.
- Updated development notes to reflect changes in the preview strategy and current project status.
- Adjusted `.gitignore` to include new entries for IntelliJ platform files.
…and error handling

- Refactored `TypstPreviewFileEditor` to extend `JCEFHtmlPanel`, enhancing the integration with the JCEF browser.
- Implemented a new loading mechanism for the Tinymist preview server, including improved error handling and user feedback.
- Added a label to inform users when JCEF is not supported in their environment.
- Updated `.gitignore` to exclude Kotlin-related files.
- Modified `.cursorignore` to comment out the IntelliJ community directory for better indexing.
- Updated `Cargo.lock` and `Cargo.toml` to reflect changes in the `tinymist-assets` dependency path.
- Added new IntelliJ project configuration files, including `.gitignore`, `compiler.xml`, `encodings.xml`, and others to enhance project setup.
- Enhanced `TypstPreviewFileEditor` with additional logging for better debugging and performance tracking.
- Introduced a new `trace.json` file for performance analysis of the preview functionality.
- Updated development notes to include current focus on preview panel scrolling performance and ongoing investigations.
…lliJ integration

- Consolidated project status and next steps into a structured roadmap format.
- Documented completed milestones, current focus on preview panel performance, and identified technical debt.
- Clarified the role of the IntelliJ plugin in the preview architecture and outlined future enhancements, including settings panel implementation and robust executable handling.
- Removed outdated sections and streamlined content for better clarity and organization.
…re consistency

- Removed dead code and placeholder logic (OutlineDataHolder, mock outline, unused updateOutline).
- Deleted and then restored a minimal TypstPreviewFileEditorProvider to serve as the preview editor provider.
- Updated TypstTextEditorWithPreviewProvider to use the correct preview provider.
- Cleaned up plugin.xml by removing commented-out tool window registration.
- Ensured all code is consistent with dev-notes and current architecture.
- Added a new `TypstFindUsagesProvider` to support finding usages of named elements in Typst files, delegating scanning to the LSP.
- Improved `TypstPreviewFileEditor` by ensuring the display handler is set up correctly and logging JavaScript console messages for better debugging.
- Updated development notes with detailed insights into frontend performance investigations and ongoing debugging efforts related to the JCEF-based preview panel.
…ure view components as they are allready done by lps4ij

- Deleted `TypstLexerAdapter`, `TypstParserDefinition`, `TypstSyntaxHighlighter`, and related structure view classes to clean up the codebase.
- These components were no longer necessary following recent refactoring and enhancements to the Typst integration.
…ations which are allready done by lsp4ij

- Updated the `lsp4ij` plugin dependency to version `0.13.0`.
- Added a new lexer definition for Typst, improving the language parsing capabilities.
- Introduced a new BNF grammar file for Typst, establishing a foundation for syntax parsing.
- Removed outdated `TinymistOutlineModel` and `TypstFindUsagesProvider` classes to streamline the codebase.
- Updated development notes to reflect changes in the architecture and language support.
@Myriad-Dreamin
Copy link
Owner

I move and edit the dev-notes. The bigest change is that we remove these two steps because we develop the intellij plugin from the root directory:

2.  **Clone the Repository:**
    ```bash
    git clone https://github.com/Myriad-Dreamin/tinymist.git
    cd tinymist/editors/intellij
    ```
3.  **Open in IntelliJ IDEA:**
    *   Open IntelliJ IDEA.
    *   Select "Open" and choose the root directory of the cloned repository.
    *   IntelliJ should automatically recognize Gradle projects. If not, you might need to import it as a Gradle project.

I mainly edit the development instructions, and leave rest part untouched. TBH, the rest parts may be summarized by LLM-powered search engine, for example, deep-wiki. I'm okay if we maintain an overview for people.

| `textDocument/documentSymbol` | ✅ Implemented | Handled by lsp4ij | Document outline/structure view |
| `textDocument/inlayHint` | ✅ Implemented | Handled by lsp4ij | Inlay additional information into code editor, i.e. the names of function parameters |
| `textDocument/codeAction` | ✅ Implemented | Handled by lsp4ij | Code fixes and refactoring actions |
| `textDocument/formatting` | ❌ Not implemented | - | Document formatting |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lsp4j can support it, why you say not implemented ?

| `textDocument/inlayHint` | ✅ Implemented | Handled by lsp4ij | Inlay additional information into code editor, i.e. the names of function parameters |
| `textDocument/codeAction` | ✅ Implemented | Handled by lsp4ij | Code fixes and refactoring actions |
| `textDocument/formatting` | ❌ Not implemented | - | Document formatting |
| `textDocument/rangeFormatting` | ❌ Not implemented | - | Range-based formatting |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lsp4j can support it, why you say not implemented ?

| `textDocument/codeAction` | ✅ Implemented | Handled by lsp4ij | Code fixes and refactoring actions |
| `textDocument/formatting` | ❌ Not implemented | - | Document formatting |
| `textDocument/rangeFormatting` | ❌ Not implemented | - | Range-based formatting |
| `textDocument/onTypeFormatting` | ❌ Not implemented | - | Format-on-type |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lsp4j can support it, why you say not implemented ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it and it did not work, however im not sure if tinymist supports it all, which is why I have left the note as unimplemented

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that you enable LSP console (set Trace as verbose in Debug tab and save it) and you will see the capabilities returned by your LSP server(do a search with onTypeFormatting)

| `textDocument/formatting` | ❌ Not implemented | - | Document formatting |
| `textDocument/rangeFormatting` | ❌ Not implemented | - | Range-based formatting |
| `textDocument/onTypeFormatting` | ❌ Not implemented | - | Format-on-type |
| `textDocument/codeLens` | ❌ Not implemented | - | Inline code annotations |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lsp4j can support it, why you say not implemented ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also need to customly implement code lens actions, which I have not done yet.

Copy link

@angelozerr angelozerr Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed but codelens should be displayed (handled by LSP4IJ), right?

| `textDocument/codeLens` | ❌ Not implemented | - | Inline code annotations |
| `textDocument/foldingRange` | ✅ Implemented | Handled by lsp4ij | Code folding regions |
| `textDocument/selectionRange` | ✅ Implemented | Handled by lsp4ij | Smart text selection |
| `textDocument/prepareCallHierarchy` | ❌ Not implemented | - | Call hierarchy preparation |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lsp4j can support it, why you say not implemented ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepareCallHierarchy also did not work in my experiments, however im not sure, where its failing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again I suggest that you enable LSP console to see if LSP request are called and if LSP server returns the proper capability.

@Myriad-Dreamin Myriad-Dreamin marked this pull request as ready for review September 14, 2025 10:32
@Myriad-Dreamin
Copy link
Owner

Myriad-Dreamin commented Sep 14, 2025

Since I have run it successfully on my computer, I believe this PR has made some significant process. It is not a problem if there are still some bugs or bad smells in current implementation, instead the only missing is to add a CI to ensure the plugin to build. We should merge it once a simple CI is built. The CI must produce some artifacts to help people use the plugin without building locally. I don't know what specific artifacts to produce, but may be some bundle like *.vsix for vscode in current CI.

@bratorange
Copy link
Author

I move and edit the dev-notes. The bigest change is that we remove these two steps because we develop the intellij plugin from the root directory:

2.  **Clone the Repository:**
    ```bash
    git clone https://github.com/Myriad-Dreamin/tinymist.git
    cd tinymist/editors/intellij
    ```
3.  **Open in IntelliJ IDEA:**
    *   Open IntelliJ IDEA.
    *   Select "Open" and choose the root directory of the cloned repository.
    *   IntelliJ should automatically recognize Gradle projects. If not, you might need to import it as a Gradle project.

I mainly edit the development instructions, and leave rest part untouched. TBH, the rest parts may be summarized by LLM-powered search engine, for example, deep-wiki. I'm okay if we maintain an overview for people.

I could also just move the build files to the tinymist root if you want.

@bratorange
Copy link
Author

Since I have run it successfully on my computer, I believe this PR has made some significant process. It is not a problem if there are still some bugs or bad smells in current implementation, instead the only missing is to add a CI to ensure the plugin to build. We should merge it once a simple CI is built. The CI must produce some artifacts to help people use the plugin without building locally. I don't know what specific artifacts to produce, but may be some bundle like *.vsix for vscode in current CI.

* [ ]  write a CI script to generate artifacts.

* [ ]  add a file `frontend/intellij.md` in https://github.com/Myriad-Dreamin/tinymist/tree/main/docs/tinymist/frontend, and describe the instructions to install the plugin from marketplace or CI.

* [ ]  ping me and we finally verify that people can get intellij integration by following the instructions.

* [ ]  merge the PR.

Great to hear! Im going to work on the CI.

@bratorange
Copy link
Author

regarding the plugin logo: I found an icon called tinymist.png. However intellij demands an svg. Do you still have that?

@Myriad-Dreamin
Copy link
Owner

regarding the plugin logo: I found an icon called tinymist.png. However intellij demands an svg. Do you still have that?

ti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants