{"id":13646503,"url":"https://github.com/mopemope/meghanada-emacs","last_synced_at":"2025-04-04T10:06:06.802Z","repository":{"id":52207512,"uuid":"67041495","full_name":"mopemope/meghanada-emacs","owner":"mopemope","description":"A Better Java Development Environment for Emacs","archived":false,"fork":false,"pushed_at":"2023-05-25T00:52:27.000Z","size":415,"stargazers_count":604,"open_issues_count":27,"forks_count":56,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-03-28T09:04:42.077Z","etag":null,"topics":["emacs","java","melpa"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mopemope.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-08-31T13:48:13.000Z","updated_at":"2025-02-15T20:42:38.000Z","dependencies_parsed_at":"2022-09-06T05:40:12.345Z","dependency_job_id":"e2b723e1-8b3b-4661-bfd4-0eeb6617ca8f","html_url":"https://github.com/mopemope/meghanada-emacs","commit_stats":null,"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopemope%2Fmeghanada-emacs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopemope%2Fmeghanada-emacs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopemope%2Fmeghanada-emacs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mopemope%2Fmeghanada-emacs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mopemope","download_url":"https://codeload.github.com/mopemope/meghanada-emacs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247156428,"owners_count":20893197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","java","melpa"],"created_at":"2024-08-02T01:02:57.560Z","updated_at":"2025-04-04T10:06:06.775Z","avatar_url":"https://github.com/mopemope.png","language":"Emacs Lisp","funding_links":["https://www.patreon.com/mopemope"],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# Meghanada-Mode [![MELPA](https://melpa.org/packages/meghanada-badge.svg)](https://melpa.org/#/meghanada) [![MELPA](http://melpa-stable.milkbox.net/packages/meghanada-badge.svg)](http://melpa-stable.milkbox.net/#/meghanada)\n\n[![Patreon](https://img.shields.io/badge/patreon-become%20a%20patron-red.svg)](https://www.patreon.com/mopemope)\n\n## Since we already have LSP, this product is no longer necessary, right?\nThis project is almost never used. This is because there is a useful product lsp-java. Please use it.\n\n## A Better Java Development Environment for Emacs\n\n`Meghanada` is a new minor-mode (`meghanada-mode`) that aims at improving the editing\nexperience for Java. It works by using a combination of an Emacs\npackage and [meghanada-server][].\n\n**Features:**\n\n- Easy install\n- Auto-update server module\n- [Gradle][] and [Maven][] and [Eclipse][] project support\n- No need build tool's plugin\n- Run build tool task\n- Compile your project\n- Syntax check and analyze java source (`flycheck-meghanada`)\n- Support `Generic Types` and `Lambda`\n- Code completion with [company-mode][] (`company-meghanada`)\n- Optimize import and sort\n- Find definitions and references using builtin [xref][]\n- Run [JUnit][] test (include test runner)\n- Diagnostic reporting with [flycheck][] (`flycheck-meghanada`)\n- Show symbol's type info with `el-doc`\n- Full-featured text search\n\n`Meghanada` is tested under `Linux`, `Windows` and `macOS`.\n\n(Welcome contributions !)\n\n## Dependencies\n\nMeghanada has been developed Emacs 25.1.1\n\n### Elisp dependencies\n\n| Package          | Version |\n| ---------------- | ------- |\n| `cl-lib`         | 0.5     |\n| [yasnippet][]    | 0.6.1   |\n| [company-mode][] | 0.9.0   |\n| [flycheck][]     | 0.23    |\n\n### Language Server\n\n`meghanada-mode` require [meghanada-server][] and JDK (not JRE).\n\n[meghanada-server][] is The language server.\nThe language server provides a simple interface between `meghanada-mode` and It is a protocol based on a simple S-expression.\nThis server is developed in Java and supports Java version 8 or later.\n\nThe architecture between the server and the client is very similar to the language server protocol.\nThe server retrieves and updates all information in the Java project at file save time and at compile time.\nIf the autocompletion information is not displayed correctly, please try to fix the compilation error first.\n\n## Installation\n\n### Elisp\n\nInstall meghanada from melpa.\n\n#### Configuration\n\nAn example is shown below.\n\n```elisp\n(require 'meghanada)\n(add-hook 'java-mode-hook\n          (lambda ()\n            ;; meghanada-mode on\n            (meghanada-mode t)\n            (flycheck-mode +1)\n            (setq c-basic-offset 2)\n            ;; use code format\n            (add-hook 'before-save-hook 'meghanada-code-beautify-before-save)))\n(cond\n   ((eq system-type 'windows-nt)\n    (setq meghanada-java-path (expand-file-name \"bin/java.exe\" (getenv \"JAVA_HOME\")))\n    (setq meghanada-maven-path \"mvn.cmd\"))\n   (t\n    (setq meghanada-java-path \"java\")\n    (setq meghanada-maven-path \"mvn\")))\n```\n\n### Meghanada-Server\n\nThe server will be automatically installed to `~/.emacs.d/meghanada/meghanada-x.x.jar`.\n\nIf you open a java file and set `meghanada-mode`, a [meghanada-server][] process starts automatically and connects to your Emacs.\n\n### Updating\n\nThe server will be automatically updated. To manually update bellows, type\n\n```\nM-x meghanada-update-server\n```\n\n### Manual Server Installation\n\nThe server will be installed and updated automatically.\n\nIf you set it up manually, please follow the instructions below.\n\n#### Download meghanada-setup.jar\n\nA meghanada-setup.jar is a small program that automatically updates the server.\n\nThis can be downloaded from:\n\nhttps://github.com/mopemope/meghanada-server/releases/download/v1.0.13/meghanada-setup-0.0.2.jar\n\nMove the downloaded setup.jar to .emacs.d/meghanada/.\nStart Emacs and enable meghanada-mode.\n\n## Autocompletion\n\nAutocompletion is supported by company-mode.\nSupported autocompletions are as follows\n\n- Import Class\n- Class\n- Method\n- Field\n- Local Variable\n\nIf the completion candidates are not displayed correctly, try to fix the compilation error first.\nAuto-completion matching is optional. Try typing the following to find out more.\n\n`M-x customize-group RET meghanada` and `M-x customize-group RET company-meghanada`.\n\n## Syntax/error checking\n\nSyntax checks, such as compile errors, are supported by `flycheck`.\nThis includes `-Xlint` warnings.\n\n## Code formatter\n\n`meghanada-mode` uses `google-java-format` by default for formatter.\n\nIt also support [Eclipse][] formatter.\n\nIf you want to customize and use the [Eclipse][] formatter please export the formatter settings from [Eclipse][] to a file.\n\nThen rename the file to `meghanadaFormatter.xml` and place it in the project root or subproject root.\n`Meghanada` will automatically load and import it.\n\nIf you want to use a system wide formatter, deploy the file to `$HOME/.emacs.d/meghanada/meghanadaFormatter.xml`.\n\n## Debug\n\n`meghanada-mode` has no debugger yet. However, the external debugger is supported.\n\nif you want to debug your code, execute `meghanada-debug-xxxx` function and then use [realgud][], etc.\n\n```\n# in Emacs now:\n M-x meghanada-debug-junit-class\n Please wait ...\n M-x realgud:jdb\n Run jdb (like this): jdb -attach 6006\n Set uncaught java.lang.Throwable\n   Set deferred uncaught java.lang.Throwable\n   Initializing jdb ...\n   \u003e\n   VM Started: No frames on the current call stack\n\n   main[1] stop at example.MyClass:100 // set breakpoint\n   main[1] run\n```\n\n## Customize\n\nTo customize other aspects of its behavior, type `M-x customize-group RET meghanada` and `M-x customize-group RET company-meghanada`.\n\n## Troubleshooting\n\nSee `*meghanada-server-log*` buffer. or `(temporary-file-directory)meghanada_server_(user-uid).log`, e.g. `/tmp/meghanada_server_1000.log`.\n\nPlease press `C-g` when emacs seems to hang.\n\n## Usage\n\nHere is a list of available interactive commands.\n\nDefinitions and references can be found from the [xref][] command.\n\n### meghanada-install-server\n\nDownload and install [meghanada-server] jar.\n\n### meghanada-update-server\n\nDownload and update [meghanada-server] jar. and restart the server process.\n\n### meghanada-server-start\n\nStart [meghanada-server][] process and connect to the server.\n\n`meghanada-mode` call this function by default. when open java file and set `meghanada-mode`.\n\n### meghanada-restart\n\nRestart [meghanada-server][] process and client process.\n\n### meghanada-server-kill\n\nKill [meghanada-server][] process.\n\n### meghanada-client-direct-connect\n\nConnect to other [meghanada-server][] directly.\n\n### meghanada-client-connect\n\nConnect to [meghanada-server][] . Call automatically at the start `meghanada-mode`.\n\n### meghanada-client-disconnect\n\nDisconnect from [meghanada-server][] .\n\n### meghanada-ping\n\nSend ping [meghanada-server][]\n\n### meghanada-clear-cache\n\nClear [meghanada-server][]'s project cache data.\n\n### meghanada-import-all (C-c C-r i)\n\nAdd import all unqualified classes.\n\n### meghanada-optimize-import (C-c C-r o)\n\nImport all and remove unused import statement.\n\nThe format of the import statement will be in `google-java-format`.\n\n### meghanada-import-at-point\n\nAdd import statement from symbol at point.\n\n### meghanada-local-variable (C-c C-r r)\n\nIntroduce local variable. (need expression is end `;`)\n\n### meghanada-compile-file (C-c C-c C-c)\n\nCompile file (and related files).\n\n### meghanada-show-project\n\nShow project details.\n\n### meghanada-compile-project (C-c C-c c)\n\nCompile project (full build and reindex).\n\n### meghanada-switch-testcase (C-M-,)\n\nSwitch test case or source.\n\n### meghanada-exec-main\n\nRun main class.\n\n### meghanada-debug-main\n\nDebug main class.\n\n### meghanada-search-everywhere\n\nIt does a full-text search based search (class, method, symbol (field)).\n\n### meghanada-search-everywhere-ex\n\nIt does a full-text search expert-mode (Enter a query for Lucene).\n\nHere is a list of fields that can be used in the search.\n\n- package\n- class\n- method\n- symbol\n- usage\n- dc (method's or field's declaring class)\n\nex. Seach class name contains `Search`.\n\n```\nclass:*Search*\n```\n\nIt can also use `AND operator`.\n\n```\ndc:*Optional* AND usage:get\n```\n\n### meghanada-typeinfo\n\nShow type hierarchies and implements interfaces.\n\n### meghanada-run-junit-class (C-c C-c C-t)\n\nRun JUnit test class.\n\n### meghanada-run-junit-test-case (C-c C-c t)\n\nRun JUnit test case (select from imenu).\n\n### meghanada-debug-junit-class (C-c C-c C-t)\n\nDebug JUnit test class.\n\n### meghanada-debug-junit-test-case (C-c C-c t)\n\nDebug JUnit test case (select from imenu).\n\n### meghanada-run-task (C-c C-v t)\n\nRun build tool task.\n\n### meghanada-code-beautify\n\nFormat buffer code. The default formatter is `google-java-format`\n\n## TODO\n\n- Refactoring\n\n## Contributing\n\nContributions are extremely welcome! Please push PR to `dev` branch.\n\n## License\n\nGPL v3, See [LICENSE](LICENSE) file.\n\n[meghanada-server]: https://github.com/mopemope/meghanada-server\n[maven]: http://maven.apache.org/\n[gradle]: https://gradle.org\n[eclipse]: https://www.eclipse.org/\n[company-mode]: http://company-mode.github.io/\n[flycheck]: https://www.flycheck.org/\n[junit]: http://www.junit.org/\n[yasnippet]: http://joaotavora.github.io/yasnippet/\n[realgud]: https://github.com/realgud/realgud\n[xref]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopemope%2Fmeghanada-emacs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmopemope%2Fmeghanada-emacs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopemope%2Fmeghanada-emacs/lists"}