├── .gitignore ├── icons ├── idea │ ├── class.png │ ├── enum.png │ ├── field.png │ ├── misc.png │ ├── advice.png │ ├── method.png │ ├── module.png │ ├── package.png │ ├── ppFile.png │ ├── snippet.png │ ├── static.png │ ├── interface.png │ ├── parameter.png │ ├── property.png │ ├── readonly.png │ ├── textArea.png │ ├── textField.png │ ├── variable.png │ └── sourceFolder.png ├── vscode │ ├── jar.png │ ├── error.png │ ├── info.png │ ├── Document.png │ ├── EnumItem.png │ ├── Indexer.png │ ├── Numeric.png │ ├── Operator.png │ ├── Template.png │ ├── expanded.png │ ├── folder.png │ ├── library.png │ ├── package.png │ ├── project.png │ ├── warning.png │ ├── Enumerator.png │ ├── classfile.png │ ├── collapsed.png │ ├── icon-flat.png │ ├── icon-link.png │ ├── symbol-key.png │ ├── BooleanData.png │ ├── ColorPalette.png │ ├── LocalVariable.png │ ├── file_type_jar.png │ ├── folder-open.png │ ├── icon-create.png │ ├── icon-refresh.png │ ├── icon-unlink.png │ ├── packagefolder.png │ ├── project-open.png │ ├── symbol-array.png │ ├── symbol-class.png │ ├── symbol-color.png │ ├── symbol-event.png │ ├── symbol-field.png │ ├── symbol-method.png │ ├── symbol-misc.png │ ├── symbol-ruler.png │ ├── symbol-string.png │ ├── default_folder.png │ ├── file_type_class.png │ ├── symbol-boolean.png │ ├── symbol-constant.png │ ├── symbol-keyword.png │ ├── symbol-numeric.png │ ├── symbol-operator.png │ ├── symbol-property.png │ ├── symbol-snippet.png │ ├── symbol-variable.png │ ├── file_type_flutter.png │ ├── folder_type_maven.png │ ├── icon-hierarchical.png │ ├── packagefolder-open.png │ ├── symbol-enumerator.png │ ├── symbol-interface.png │ ├── symbol-namespace.png │ ├── symbol-parameter.png │ ├── symbol-structure.png │ ├── IntelliSenseKeyword.png │ ├── default_root_folder.png │ ├── folder_type_library.png │ ├── folder_type_package.png │ ├── default_folder_opened.png │ ├── folder_type_component.png │ ├── folder_type_maven_opened.png │ ├── symbol-enumerator-member.png │ ├── default_root_folder_opened.png │ ├── folder_type_component_opened.png │ ├── folder_type_library_opened.png │ └── folder_type_package_opened.png ├── eclipse │ ├── enum.png │ ├── text.png │ ├── boolean.png │ ├── class.png │ ├── enum@2x.png │ ├── field.png │ ├── keyword.png │ ├── method.png │ ├── module.png │ ├── number.png │ ├── package.png │ ├── snippet.png │ ├── text@2x.png │ ├── value.png │ ├── class@2x.png │ ├── constant.png │ ├── field@2x.png │ ├── function.png │ ├── interface.png │ ├── method@2x.png │ ├── module@2x.png │ ├── namespace.png │ ├── number@2x.png │ ├── property.png │ ├── reference.png │ ├── value@2x.png │ ├── variable.png │ ├── boolean@2x.png │ ├── constant@2x.png │ ├── constructor.png │ ├── function@2x.png │ ├── interface@2x.png │ ├── keyword@2x.png │ ├── namespace@2x.png │ ├── package@2x.png │ ├── property@2x.png │ ├── reference@2x.png │ ├── snippet@2x.png │ ├── variable@2x.png │ └── constructor@2x.png └── netbeans │ ├── class.png │ ├── color.gif │ ├── empty.png │ ├── enum.png │ ├── event.png │ ├── field.png │ ├── file.png │ ├── folder.gif │ ├── method.png │ ├── module.png │ ├── struct.png │ ├── text.png │ ├── unit.png │ ├── value.png │ ├── constant.png │ ├── function.png │ ├── keyword.png │ ├── operator.png │ ├── property.png │ ├── snippet.png │ ├── variable.gif │ ├── attribute.png │ ├── constructor.png │ ├── enummember.png │ ├── interface.png │ ├── reference.png │ └── typeparameter.gif ├── screenshots ├── error-list.png ├── references.gif ├── call-hierarchy.gif ├── dependencies.gif └── symbols-list.gif ├── Makefile ├── Eask ├── .github └── workflows │ └── test.yml ├── README.org ├── lsp-treemacs-generic.el ├── lsp-treemacs-themes.el ├── LICENSE └── lsp-treemacs.el /.gitignore: -------------------------------------------------------------------------------- 1 | *.elc 2 | .eask 3 | /dist 4 | -------------------------------------------------------------------------------- /icons/idea/class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/class.png -------------------------------------------------------------------------------- /icons/idea/enum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/enum.png -------------------------------------------------------------------------------- /icons/idea/field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/field.png -------------------------------------------------------------------------------- /icons/idea/misc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/misc.png -------------------------------------------------------------------------------- /icons/vscode/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/jar.png -------------------------------------------------------------------------------- /icons/eclipse/enum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/enum.png -------------------------------------------------------------------------------- /icons/eclipse/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/text.png -------------------------------------------------------------------------------- /icons/idea/advice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/advice.png -------------------------------------------------------------------------------- /icons/idea/method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/method.png -------------------------------------------------------------------------------- /icons/idea/module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/module.png -------------------------------------------------------------------------------- /icons/idea/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/package.png -------------------------------------------------------------------------------- /icons/idea/ppFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/ppFile.png -------------------------------------------------------------------------------- /icons/idea/snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/snippet.png -------------------------------------------------------------------------------- /icons/idea/static.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/static.png -------------------------------------------------------------------------------- /icons/vscode/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/error.png -------------------------------------------------------------------------------- /icons/vscode/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/info.png -------------------------------------------------------------------------------- /icons/eclipse/boolean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/boolean.png -------------------------------------------------------------------------------- /icons/eclipse/class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/class.png -------------------------------------------------------------------------------- /icons/eclipse/enum@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/enum@2x.png -------------------------------------------------------------------------------- /icons/eclipse/field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/field.png -------------------------------------------------------------------------------- /icons/eclipse/keyword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/keyword.png -------------------------------------------------------------------------------- /icons/eclipse/method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/method.png -------------------------------------------------------------------------------- /icons/eclipse/module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/module.png -------------------------------------------------------------------------------- /icons/eclipse/number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/number.png -------------------------------------------------------------------------------- /icons/eclipse/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/package.png -------------------------------------------------------------------------------- /icons/eclipse/snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/snippet.png -------------------------------------------------------------------------------- /icons/eclipse/text@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/text@2x.png -------------------------------------------------------------------------------- /icons/eclipse/value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/value.png -------------------------------------------------------------------------------- /icons/idea/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/interface.png -------------------------------------------------------------------------------- /icons/idea/parameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/parameter.png -------------------------------------------------------------------------------- /icons/idea/property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/property.png -------------------------------------------------------------------------------- /icons/idea/readonly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/readonly.png -------------------------------------------------------------------------------- /icons/idea/textArea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/textArea.png -------------------------------------------------------------------------------- /icons/idea/textField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/textField.png -------------------------------------------------------------------------------- /icons/idea/variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/variable.png -------------------------------------------------------------------------------- /icons/netbeans/class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/class.png -------------------------------------------------------------------------------- /icons/netbeans/color.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/color.gif -------------------------------------------------------------------------------- /icons/netbeans/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/empty.png -------------------------------------------------------------------------------- /icons/netbeans/enum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/enum.png -------------------------------------------------------------------------------- /icons/netbeans/event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/event.png -------------------------------------------------------------------------------- /icons/netbeans/field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/field.png -------------------------------------------------------------------------------- /icons/netbeans/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/file.png -------------------------------------------------------------------------------- /icons/netbeans/folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/folder.gif -------------------------------------------------------------------------------- /icons/netbeans/method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/method.png -------------------------------------------------------------------------------- /icons/netbeans/module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/module.png -------------------------------------------------------------------------------- /icons/netbeans/struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/struct.png -------------------------------------------------------------------------------- /icons/netbeans/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/text.png -------------------------------------------------------------------------------- /icons/netbeans/unit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/unit.png -------------------------------------------------------------------------------- /icons/netbeans/value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/value.png -------------------------------------------------------------------------------- /icons/vscode/Document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Document.png -------------------------------------------------------------------------------- /icons/vscode/EnumItem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/EnumItem.png -------------------------------------------------------------------------------- /icons/vscode/Indexer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Indexer.png -------------------------------------------------------------------------------- /icons/vscode/Numeric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Numeric.png -------------------------------------------------------------------------------- /icons/vscode/Operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Operator.png -------------------------------------------------------------------------------- /icons/vscode/Template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Template.png -------------------------------------------------------------------------------- /icons/vscode/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/expanded.png -------------------------------------------------------------------------------- /icons/vscode/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder.png -------------------------------------------------------------------------------- /icons/vscode/library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/library.png -------------------------------------------------------------------------------- /icons/vscode/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/package.png -------------------------------------------------------------------------------- /icons/vscode/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/project.png -------------------------------------------------------------------------------- /icons/vscode/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/warning.png -------------------------------------------------------------------------------- /icons/eclipse/class@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/class@2x.png -------------------------------------------------------------------------------- /icons/eclipse/constant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/constant.png -------------------------------------------------------------------------------- /icons/eclipse/field@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/field@2x.png -------------------------------------------------------------------------------- /icons/eclipse/function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/function.png -------------------------------------------------------------------------------- /icons/eclipse/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/interface.png -------------------------------------------------------------------------------- /icons/eclipse/method@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/method@2x.png -------------------------------------------------------------------------------- /icons/eclipse/module@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/module@2x.png -------------------------------------------------------------------------------- /icons/eclipse/namespace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/namespace.png -------------------------------------------------------------------------------- /icons/eclipse/number@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/number@2x.png -------------------------------------------------------------------------------- /icons/eclipse/property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/property.png -------------------------------------------------------------------------------- /icons/eclipse/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/reference.png -------------------------------------------------------------------------------- /icons/eclipse/value@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/value@2x.png -------------------------------------------------------------------------------- /icons/eclipse/variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/variable.png -------------------------------------------------------------------------------- /icons/idea/sourceFolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/idea/sourceFolder.png -------------------------------------------------------------------------------- /icons/netbeans/constant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/constant.png -------------------------------------------------------------------------------- /icons/netbeans/function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/function.png -------------------------------------------------------------------------------- /icons/netbeans/keyword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/keyword.png -------------------------------------------------------------------------------- /icons/netbeans/operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/operator.png -------------------------------------------------------------------------------- /icons/netbeans/property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/property.png -------------------------------------------------------------------------------- /icons/netbeans/snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/snippet.png -------------------------------------------------------------------------------- /icons/netbeans/variable.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/variable.gif -------------------------------------------------------------------------------- /icons/vscode/Enumerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/Enumerator.png -------------------------------------------------------------------------------- /icons/vscode/classfile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/classfile.png -------------------------------------------------------------------------------- /icons/vscode/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/collapsed.png -------------------------------------------------------------------------------- /icons/vscode/icon-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-flat.png -------------------------------------------------------------------------------- /icons/vscode/icon-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-link.png -------------------------------------------------------------------------------- /icons/vscode/symbol-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-key.png -------------------------------------------------------------------------------- /screenshots/error-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/screenshots/error-list.png -------------------------------------------------------------------------------- /screenshots/references.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/screenshots/references.gif -------------------------------------------------------------------------------- /icons/eclipse/boolean@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/boolean@2x.png -------------------------------------------------------------------------------- /icons/eclipse/constant@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/constant@2x.png -------------------------------------------------------------------------------- /icons/eclipse/constructor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/constructor.png -------------------------------------------------------------------------------- /icons/eclipse/function@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/function@2x.png -------------------------------------------------------------------------------- /icons/eclipse/interface@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/interface@2x.png -------------------------------------------------------------------------------- /icons/eclipse/keyword@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/keyword@2x.png -------------------------------------------------------------------------------- /icons/eclipse/namespace@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/namespace@2x.png -------------------------------------------------------------------------------- /icons/eclipse/package@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/package@2x.png -------------------------------------------------------------------------------- /icons/eclipse/property@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/property@2x.png -------------------------------------------------------------------------------- /icons/eclipse/reference@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/reference@2x.png -------------------------------------------------------------------------------- /icons/eclipse/snippet@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/snippet@2x.png -------------------------------------------------------------------------------- /icons/eclipse/variable@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/variable@2x.png -------------------------------------------------------------------------------- /icons/netbeans/attribute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/attribute.png -------------------------------------------------------------------------------- /icons/netbeans/constructor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/constructor.png -------------------------------------------------------------------------------- /icons/netbeans/enummember.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/enummember.png -------------------------------------------------------------------------------- /icons/netbeans/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/interface.png -------------------------------------------------------------------------------- /icons/netbeans/reference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/reference.png -------------------------------------------------------------------------------- /icons/vscode/BooleanData.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/BooleanData.png -------------------------------------------------------------------------------- /icons/vscode/ColorPalette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/ColorPalette.png -------------------------------------------------------------------------------- /icons/vscode/LocalVariable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/LocalVariable.png -------------------------------------------------------------------------------- /icons/vscode/file_type_jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/file_type_jar.png -------------------------------------------------------------------------------- /icons/vscode/folder-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder-open.png -------------------------------------------------------------------------------- /icons/vscode/icon-create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-create.png -------------------------------------------------------------------------------- /icons/vscode/icon-refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-refresh.png -------------------------------------------------------------------------------- /icons/vscode/icon-unlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-unlink.png -------------------------------------------------------------------------------- /icons/vscode/packagefolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/packagefolder.png -------------------------------------------------------------------------------- /icons/vscode/project-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/project-open.png -------------------------------------------------------------------------------- /icons/vscode/symbol-array.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-array.png -------------------------------------------------------------------------------- /icons/vscode/symbol-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-class.png -------------------------------------------------------------------------------- /icons/vscode/symbol-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-color.png -------------------------------------------------------------------------------- /icons/vscode/symbol-event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-event.png -------------------------------------------------------------------------------- /icons/vscode/symbol-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-field.png -------------------------------------------------------------------------------- /icons/vscode/symbol-method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-method.png -------------------------------------------------------------------------------- /icons/vscode/symbol-misc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-misc.png -------------------------------------------------------------------------------- /icons/vscode/symbol-ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-ruler.png -------------------------------------------------------------------------------- /icons/vscode/symbol-string.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-string.png -------------------------------------------------------------------------------- /screenshots/call-hierarchy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/screenshots/call-hierarchy.gif -------------------------------------------------------------------------------- /screenshots/dependencies.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/screenshots/dependencies.gif -------------------------------------------------------------------------------- /screenshots/symbols-list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/screenshots/symbols-list.gif -------------------------------------------------------------------------------- /icons/eclipse/constructor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/eclipse/constructor@2x.png -------------------------------------------------------------------------------- /icons/netbeans/typeparameter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/netbeans/typeparameter.gif -------------------------------------------------------------------------------- /icons/vscode/default_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/default_folder.png -------------------------------------------------------------------------------- /icons/vscode/file_type_class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/file_type_class.png -------------------------------------------------------------------------------- /icons/vscode/symbol-boolean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-boolean.png -------------------------------------------------------------------------------- /icons/vscode/symbol-constant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-constant.png -------------------------------------------------------------------------------- /icons/vscode/symbol-keyword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-keyword.png -------------------------------------------------------------------------------- /icons/vscode/symbol-numeric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-numeric.png -------------------------------------------------------------------------------- /icons/vscode/symbol-operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-operator.png -------------------------------------------------------------------------------- /icons/vscode/symbol-property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-property.png -------------------------------------------------------------------------------- /icons/vscode/symbol-snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-snippet.png -------------------------------------------------------------------------------- /icons/vscode/symbol-variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-variable.png -------------------------------------------------------------------------------- /icons/vscode/file_type_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/file_type_flutter.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_maven.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_maven.png -------------------------------------------------------------------------------- /icons/vscode/icon-hierarchical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/icon-hierarchical.png -------------------------------------------------------------------------------- /icons/vscode/packagefolder-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/packagefolder-open.png -------------------------------------------------------------------------------- /icons/vscode/symbol-enumerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-enumerator.png -------------------------------------------------------------------------------- /icons/vscode/symbol-interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-interface.png -------------------------------------------------------------------------------- /icons/vscode/symbol-namespace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-namespace.png -------------------------------------------------------------------------------- /icons/vscode/symbol-parameter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-parameter.png -------------------------------------------------------------------------------- /icons/vscode/symbol-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-structure.png -------------------------------------------------------------------------------- /icons/vscode/IntelliSenseKeyword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/IntelliSenseKeyword.png -------------------------------------------------------------------------------- /icons/vscode/default_root_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/default_root_folder.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_library.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_package.png -------------------------------------------------------------------------------- /icons/vscode/default_folder_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/default_folder_opened.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_component.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_maven_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_maven_opened.png -------------------------------------------------------------------------------- /icons/vscode/symbol-enumerator-member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/symbol-enumerator-member.png -------------------------------------------------------------------------------- /icons/vscode/default_root_folder_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/default_root_folder_opened.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_component_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_component_opened.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_library_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_library_opened.png -------------------------------------------------------------------------------- /icons/vscode/folder_type_package_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-lsp/lsp-treemacs/HEAD/icons/vscode/folder_type_package_opened.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | EMACS ?= emacs 2 | EASK ?= eask 3 | 4 | .PHONY: all build compile clean 5 | 6 | ci: clean build compile 7 | 8 | all: 9 | $(EASK) build 10 | 11 | build: 12 | $(EASK) package 13 | $(EASK) install 14 | 15 | compile: 16 | $(EASK) compile 17 | 18 | checkdoc: 19 | $(EASK) checkdoc 20 | 21 | lint: 22 | $(EASK) lint 23 | 24 | clean: 25 | $(EASK) clean all 26 | -------------------------------------------------------------------------------- /Eask: -------------------------------------------------------------------------------- 1 | ;; -*- mode: eask; lexical-binding: t -*- 2 | 3 | (package "lsp-treemacs" 4 | "0.5" 5 | "LSP treemacs") 6 | 7 | (website-url "https://github.com/emacs-lsp/lsp-treemacs") 8 | (keywords "languages") 9 | 10 | (package-file "lsp-treemacs.el") 11 | 12 | (files "*.el") 13 | 14 | (script "test" "echo \"Error: no test specified\" && exit 1") 15 | 16 | (source 'gnu) 17 | (source 'melpa) 18 | 19 | (depends-on "emacs" "28.1") 20 | (depends-on "dash") 21 | (depends-on "f") 22 | (depends-on "ht") 23 | (depends-on "treemacs") 24 | (depends-on "lsp-mode") 25 | 26 | (development 27 | (depends-on "spinner")) 28 | 29 | (setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 30 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | continue-on-error: ${{ matrix.experimental }} 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | os: [ubuntu-latest, macos-latest, windows-latest] 13 | emacs-version: 14 | - 28.2 15 | - 29.4 16 | - 30.1 17 | experimental: [false] 18 | include: 19 | - os: ubuntu-latest 20 | emacs-version: snapshot 21 | experimental: true 22 | - os: macos-latest 23 | emacs-version: snapshot 24 | experimental: true 25 | - os: windows-latest 26 | emacs-version: snapshot 27 | experimental: true 28 | 29 | steps: 30 | - uses: actions/checkout@v3 31 | 32 | - uses: jcs090218/setup-emacs@master 33 | with: 34 | version: ${{ matrix.emacs-version }} 35 | 36 | - uses: emacs-eask/setup-eask@master 37 | with: 38 | version: 'snapshot' 39 | 40 | - name: Run tests 41 | run: make ci 42 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | [[https://github.com/emacs-lsp/lsp-treemacs/actions][file:https://github.com/emacs-lsp/lsp-treemacs/workflows/CI/badge.svg]] 2 | [[https://melpa.org/#/lsp-treemacs][file:https://melpa.org/packages/lsp-treemacs-badge.svg]] 3 | [[https://stable.melpa.org/#/lsp-treemacs][file:https://stable.melpa.org/packages/lsp-treemacs-badge.svg]] 4 | 5 | * Table of Contents :TOC_4_gh:noexport: 6 | - [[#summary][Summary]] 7 | - [[#synchronization][Synchronization]] 8 | - [[#views][Views]] 9 | - [[#lsp-treemacs-errors-list][lsp-treemacs-errors-list]] 10 | - [[#commands][Commands]] 11 | - [[#screenshot][Screenshot]] 12 | - [[#lsp-treemacs-symbols][lsp-treemacs-symbols]] 13 | - [[#screenshot-1][Screenshot]] 14 | - [[#lsp-treemacs-referenceslsp-treemacs-implementations][lsp-treemacs-references/lsp-treemacs-implementations]] 15 | - [[#screenshot-2][Screenshot]] 16 | - [[#lsp-treemacs-call-hierarchy][lsp-treemacs-call-hierarchy]] 17 | - [[#screenshot-3][Screenshot]] 18 | - [[#lsp-treemacs-type-hierarchy][lsp-treemacs-type-hierarchy]] 19 | - [[#lsp-treemacs-deps-list][lsp-treemacs-deps-list]] 20 | - [[#commands-1][Commands]] 21 | - [[#screenshot-4][Screenshot]] 22 | 23 | * Summary 24 | Integration between [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]] and [[https://github.com/Alexander-Miller/treemacs][treemacs]] and implementation of treeview controls using [[https://github.com/Alexander-Miller/treemacs][treemacs]] as a tree renderer. 25 | * Synchronization 26 | To enable bidirectional synchronization of lsp workspace folders and [[https://github.com/Alexander-Miller/treemacs][treemacs]] projects. 27 | #+begin_src emacs-lisp 28 | (lsp-treemacs-sync-mode 1) 29 | #+end_src 30 | * Views 31 | ** lsp-treemacs-errors-list 32 | Displays tree like error list structure. 33 | *** Commands 34 | *** Screenshot 35 | [[file:screenshots/error-list.png]] 36 | - ~lsp-treemacs-quick-fix~ or press ~x~ when you are in Error List view - offer quickfixes for the error at point. 37 | ** lsp-treemacs-symbols 38 | Displays symbols information. 39 | *** Screenshot 40 | [[file:screenshots/symbols-list.gif]] 41 | ** lsp-treemacs-references/lsp-treemacs-implementations 42 | Display references/implementations using tree view: 43 | *** Screenshot 44 | [[file:screenshots/references.gif]] 45 | 46 | ** lsp-treemacs-call-hierarchy 47 | Display call hierarchy. Use =C-u M-x lsp-treemacs-call-hierarchy= to display outgoing call hierarchy. 48 | *** Screenshot 49 | [[file:screenshots/call-hierarchy.gif]] 50 | ** lsp-treemacs-type-hierarchy 51 | Display type hierarchy. 52 | ** lsp-treemacs-deps-list 53 | Browse java dependencies, namespaces, files, etc. 54 | *** Commands 55 | - ~lsp-treemacs-java-deps-follow~ - select the current editor in the dependency 56 | - ~lsp-treemacs-java-deps-refresh~ - refresh the view. Bound to ~r~. 57 | *** Screenshot 58 | [[file:screenshots/dependencies.gif]] 59 | -------------------------------------------------------------------------------- /lsp-treemacs-generic.el: -------------------------------------------------------------------------------- 1 | ;;; lsp-treemacs-generic.el --- treemacs wrapper -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022 Ivan Yonchovski 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: data 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'lsp-mode) 28 | 29 | (require 'treemacs) 30 | (require 'treemacs-treelib) 31 | (require 'lsp-treemacs-themes) 32 | 33 | (defvar-local lsp-treemacs-tree nil) 34 | (defvar-local lsp-treemacs--right-click-actions nil) 35 | (defvar-local lsp-treemacs-generic-filter nil) 36 | 37 | (declare-function lsp-treemacs--set-mode-line-format "lsp-treemacs.el") 38 | 39 | (defmacro lsp-treemacs-wcb-unless-killed (buffer &rest body) 40 | "`with-current-buffer' unless buffer killed." 41 | (declare (indent 1) (debug t)) 42 | `(when (buffer-live-p (get-buffer ,buffer)) 43 | (with-current-buffer ,buffer 44 | ,@body))) 45 | 46 | (defun lsp-treemacs-generic-refresh (&optional _cache) 47 | (condition-case _err 48 | (let ((inhibit-read-only t)) 49 | (treemacs-update-node '(lsp-treemacs-generic-root))) 50 | (error))) 51 | 52 | (defun lsp-treemacs-generic-update (tree) 53 | (setq lsp-treemacs-tree tree) 54 | (lsp-treemacs-generic-refresh)) 55 | 56 | (defun lsp-treemacs-generic-right-click (event) 57 | (interactive "e") 58 | (let* ((ec (event-start event)) 59 | (p1 (posn-point ec)) 60 | (w1 (posn-window ec))) 61 | (select-window w1) 62 | (goto-char p1) 63 | (hl-line-highlight) 64 | (run-with-idle-timer 65 | 0.001 nil 66 | (lambda () 67 | (-when-let* ((actions (if-let (node (treemacs-node-at-point)) 68 | (lsp-resolve-value (plist-get (button-get node :item) :actions)) 69 | lsp-treemacs--right-click-actions)) 70 | (menu (easy-menu-create-menu nil actions)) 71 | (choice (x-popup-menu event menu))) 72 | (when choice (call-interactively (lookup-key menu (apply 'vector choice)))) 73 | (hl-line-highlight)))))) 74 | 75 | (defvar lsp-treemacs-generic-map 76 | (-doto (make-sparse-keymap) 77 | (define-key [mouse-1] #'treemacs-TAB-action) 78 | (define-key [double-mouse-1] #'treemacs-RET-action) 79 | (define-key [mouse-3] #'lsp-treemacs-generic-right-click)) 80 | "Keymap for `lsp-treemacs-generic-mode'") 81 | 82 | (define-minor-mode lsp-treemacs-generic-mode "Treemacs generic mode." 83 | :keymap lsp-treemacs-generic-map) 84 | 85 | (defun lsp-treemacs--generic-icon (item expanded?) 86 | "Get the symbol for the the kind." 87 | (concat 88 | (if (or (plist-get item :children) 89 | (plist-get item :children-async)) 90 | (if expanded? "▾ " "▸ ") 91 | " ") 92 | (or (plist-get item :icon-literal) 93 | (-if-let (icon (plist-get item :icon)) 94 | (treemacs-get-icon-value 95 | icon 96 | nil 97 | lsp-treemacs-theme) 98 | " ")))) 99 | 100 | (defun lsp-treemacs-filter-if-needed (result) 101 | (if lsp-treemacs-generic-filter 102 | (funcall lsp-treemacs-generic-filter result) 103 | result)) 104 | 105 | (defun lsp-treemacs-perform-ret-action (&rest _) 106 | (interactive) 107 | (if-let (action (-> (treemacs-node-at-point) 108 | (button-get :item) 109 | (plist-get :ret-action))) 110 | (funcall-interactively action) 111 | (treemacs-pulse-on-failure "No ret action defined."))) 112 | 113 | (treemacs-define-expandable-node-type lsp-treemacs-generic-node 114 | :closed-icon (lsp-treemacs--generic-icon item nil) 115 | :open-icon (lsp-treemacs--generic-icon item t) 116 | :label (plist-get item :label) 117 | :key (plist-get item :key) 118 | :ret-action #'lsp-treemacs-perform-ret-action 119 | :children (-let (((item &as &plist :children :children-async) item)) 120 | (cond 121 | ((functionp children) (->> (funcall children item) 122 | (lsp-treemacs-filter-if-needed) 123 | (funcall callback))) 124 | (children-async 125 | (-let [buffer (current-buffer)] 126 | (funcall children-async 127 | item 128 | (lambda (result) 129 | (lsp-treemacs-wcb-unless-killed buffer 130 | (funcall callback (lsp-treemacs-filter-if-needed result))))))) 131 | (t (funcall callback (lsp-treemacs-filter-if-needed children))))) 132 | :child-type 'lsp-treemacs-generic-node 133 | :async? t) 134 | 135 | (treemacs-define-variadic-entry-node-type lsp-treemacs-generic-root 136 | :key 'lsp-treemacs-generic-root 137 | :children lsp-treemacs-tree 138 | :child-type 'lsp-treemacs-generic-node) 139 | 140 | (defun lsp-treemacs-render (tree title expand-depth 141 | &optional buffer-name right-click-actions _clear-cache?) 142 | (let ((buffer (get-buffer-create (or buffer-name "*LSP Lookup*")))) 143 | (with-current-buffer buffer 144 | (treemacs-initialize lsp-treemacs-generic-root 145 | :with-expand-depth (or expand-depth 0) 146 | :and-do (progn 147 | (lsp-treemacs--set-mode-line-format buffer title) 148 | (setq-local face-remapping-alist '((button . default))) 149 | (setq-local lsp-treemacs-tree tree) 150 | (setq-local treemacs-default-visit-action 'treemacs-RET-action) 151 | (setq-local lsp-treemacs--right-click-actions right-click-actions) 152 | (setq-local window-size-fixed nil) 153 | (setq-local treemacs--width-is-locked nil) 154 | (setq-local treemacs-space-between-root-nodes nil) 155 | (when treemacs-text-scale 156 | (text-scale-increase treemacs-text-scale)) 157 | (lsp-treemacs-generic-mode t))) 158 | (current-buffer)))) 159 | 160 | (provide 'lsp-treemacs-generic) 161 | ;;; lsp-treemacs-generic.el ends here 162 | -------------------------------------------------------------------------------- /lsp-treemacs-themes.el: -------------------------------------------------------------------------------- 1 | ;;; lsp-treemacs-themes.el --- LSP treemacs themes -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2020 Eric Dallo 4 | 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | ;; 18 | ;; This file is not part of GNU Emacs. 19 | ;; 20 | ;;; Commentary: 21 | ;; 22 | ;; LSP treemacs themes 23 | ;; 24 | ;;; Code: 25 | 26 | (require 'f) 27 | (require 'treemacs) 28 | (require 'treemacs-themes) 29 | 30 | (defcustom lsp-treemacs-theme "Default" 31 | "The `lsp-treemacs' theme." 32 | :type 'string 33 | :group 'lsp-treemacs) 34 | 35 | (treemacs-modify-theme "Default" 36 | :icon-directory (f-join (f-dirname (or load-file-name buffer-file-name)) "icons/vscode") 37 | :config 38 | (progn 39 | (treemacs-create-icon :file "BooleanData.png" :extensions (boolean-data) :fallback "-") 40 | (treemacs-create-icon :file "ColorPalette.png" :extensions (color-palette) :fallback "-") 41 | (treemacs-create-icon :file "Document.png" :extensions (document) :fallback "-") 42 | (treemacs-create-icon :file "Enumerator.png" :extensions (enumerator) :fallback "-") 43 | (treemacs-create-icon :file "EnumItem.png" :extensions (enumitem) :fallback "-") 44 | (treemacs-create-icon :file "Indexer.png" :extensions (indexer) :fallback "-") 45 | (treemacs-create-icon :file "IntelliSenseKeyword.png" :extensions (intellisense-keyword) :fallback "-") 46 | (treemacs-create-icon :file "LocalVariable.png" :extensions (localvariable) :fallback "-") 47 | (treemacs-create-icon :file "Numeric.png" :extensions (numeric) :fallback "-") 48 | (treemacs-create-icon :file "Operator.png" :extensions (operator) :fallback "-") 49 | (treemacs-create-icon :file "Template.png" :extensions (template) :fallback "-") 50 | (treemacs-create-icon :file "collapsed.png" :extensions (collapsed) :fallback "-") 51 | (treemacs-create-icon :file "expanded.png" :extensions (expanded) :fallback "-") 52 | (treemacs-create-icon :file "classfile.png" :extensions (classfile) :fallback "-") 53 | (treemacs-create-icon :file "default_folder_opened.png" :extensions (default-folder-opened) :fallback "-") 54 | (treemacs-create-icon :file "default_folder.png" :extensions (default-folder) :fallback "-") 55 | (treemacs-create-icon :file "default_root_folder_opened.png" :extensions (default-root-folder-opened) :fallback "-") 56 | (treemacs-create-icon :file "default_root_folder.png" :extensions (default-root-folder) :fallback "-") 57 | (treemacs-create-icon :file "file_type_class.png" :extensions ("class") :fallback "-") 58 | (treemacs-create-icon :file "file_type_jar.png" :extensions (file-type-jar) :fallback "-") 59 | (treemacs-create-icon :file "file_type_flutter.png" :extensions (flutter) :fallback "-") 60 | (treemacs-create-icon :file "folder-open.png" :extensions (folder-open) :fallback "-") 61 | (treemacs-create-icon :file "folder.png" :extensions (folder) :fallback "-") 62 | (treemacs-create-icon :file "folder_type_component_opened.png" :extensions (folder-type-component-opened) :fallback "-") 63 | (treemacs-create-icon :file "folder_type_component.png" :extensions (folder-type-component) :fallback "-") 64 | (treemacs-create-icon :file "folder_type_library_opened.png" :extensions (folder-type-library-opened) :fallback "-") 65 | (treemacs-create-icon :file "folder_type_library.png" :extensions (folder-type-library) :fallback "-") 66 | (treemacs-create-icon :file "folder_type_maven_opened.png" :extensions (folder-type-maven-opened) :fallback "-") 67 | (treemacs-create-icon :file "folder_type_maven.png" :extensions (folder-type-maven) :fallback "-") 68 | (treemacs-create-icon :file "folder_type_package_opened.png" :extensions (folder-type-package-opened) :fallback "-") 69 | (treemacs-create-icon :file "folder_type_package.png" :extensions (folder-type-package) :fallback "-") 70 | (treemacs-create-icon :file "icon-create.png" :extensions (icon-create) :fallback "-") 71 | (treemacs-create-icon :file "icon-flat.png" :extensions (icon-flat) :fallback "-") 72 | (treemacs-create-icon :file "icon-hierarchical.png" :extensions (icon-hierarchical) :fallback "-") 73 | (treemacs-create-icon :file "icon-link.png" :extensions (icon-link) :fallback "-") 74 | (treemacs-create-icon :file "icon-refresh.png" :extensions (icon-refresh) :fallback "-") 75 | (treemacs-create-icon :file "icon-unlink.png" :extensions (icon-unlink) :fallback "-") 76 | (treemacs-create-icon :file "jar.png" :extensions (jar) :fallback "-") 77 | (treemacs-create-icon :file "library.png" :extensions (library) :fallback "-") 78 | (treemacs-create-icon :file "packagefolder-open.png" :extensions (packagefolder-open) :fallback "-") 79 | (treemacs-create-icon :file "packagefolder.png" :extensions (packagefolder) :fallback "-") 80 | (treemacs-create-icon :file "package.png" :extensions (package) :fallback "-") 81 | (treemacs-create-icon :file "project.png" :extensions (java-project) :fallback "-") 82 | 83 | (treemacs-create-icon :file "symbol-array.png" :extensions (array) :fallback "-") 84 | (treemacs-create-icon :file "symbol-boolean.png" :extensions (boolean) :fallback "-") 85 | (treemacs-create-icon :file "symbol-class.png" :extensions (class) :fallback "-") 86 | (treemacs-create-icon :file "symbol-color.png" :extensions (color) :fallback "-") 87 | (treemacs-create-icon :file "symbol-constant.png" :extensions (constant) :fallback "-") 88 | (treemacs-create-icon :file "symbol-enumerator-member.png" :extensions (enum-member) :fallback "-") 89 | (treemacs-create-icon :file "symbol-enumerator.png" :extensions (enum) :fallback "-") 90 | (treemacs-create-icon :file "symbol-event.png" :extensions (event) :fallback "-") 91 | (treemacs-create-icon :file "symbol-field.png" :extensions (field) :fallback "-") 92 | (treemacs-create-icon :file "symbol-interface.png" :extensions (interface) :fallback "-") 93 | (treemacs-create-icon :file "symbol-key.png" :extensions (key) :fallback "-") 94 | (treemacs-create-icon :file "symbol-keyword.png" :extensions (keyword) :fallback "-") 95 | (treemacs-create-icon :file "symbol-method.png" :extensions (method) :fallback "-") 96 | (treemacs-create-icon :file "symbol-misc.png" :extensions (misc) :fallback "-") 97 | (treemacs-create-icon :file "symbol-namespace.png" :extensions (namespace) :fallback "-") 98 | (treemacs-create-icon :file "symbol-namespace.png" :extensions (module) :fallback "-") 99 | (treemacs-create-icon :file "symbol-numeric.png" :extensions (numeric) :fallback "-") 100 | (treemacs-create-icon :file "symbol-operator.png" :extensions (operator) :fallback "-") 101 | (treemacs-create-icon :file "symbol-parameter.png" :extensions (parameter) :fallback "-") 102 | (treemacs-create-icon :file "symbol-property.png" :extensions (property) :fallback "-") 103 | (treemacs-create-icon :file "symbol-ruler.png" :extensions (ruler) :fallback "-") 104 | (treemacs-create-icon :file "symbol-snippet.png" :extensions (snippet) :fallback "-") 105 | (treemacs-create-icon :file "symbol-string.png" :extensions (string) :fallback "-") 106 | (treemacs-create-icon :file "symbol-structure.png" :extensions (struct) :fallback "-") 107 | (treemacs-create-icon :file "symbol-variable.png" :extensions (variable) :fallback "-"))) 108 | 109 | (treemacs-create-theme "Eclipse" 110 | :extends "Default" 111 | :icon-directory (f-join (f-dirname (or load-file-name buffer-file-name)) "icons/eclipse") 112 | :config 113 | (progn 114 | (treemacs-create-icon :file "vscode/Namespace.png" :extensions (namespace) :fallback "-") 115 | (treemacs-create-icon :file "text.png" :extensions (text) :fallback "-") 116 | (treemacs-create-icon :file "method.png" :extensions (method) :fallback "-") 117 | (treemacs-create-icon :file "function.png" :extensions (function) :fallback "-") 118 | (treemacs-create-icon :file "constructor.png" :extensions (constructor) :fallback "-") 119 | (treemacs-create-icon :file "field.png" :extensions (field) :fallback "-") 120 | (treemacs-create-icon :file "variable.png" :extensions (variable) :fallback "-") 121 | (treemacs-create-icon :file "class.png" :extensions (class) :fallback "-") 122 | (treemacs-create-icon :file "interface.png" :extensions (interface) :fallback "-") 123 | (treemacs-create-icon :file "module.png" :extensions (module) :fallback "-") 124 | (treemacs-create-icon :file "property.png" :extensions (property) :fallback "-") 125 | (treemacs-create-icon :file "unit.png" :extensions (unit) :fallback "-") 126 | (treemacs-create-icon :file "value.png" :extensions (value) :fallback "-") 127 | (treemacs-create-icon :file "enum.png" :extensions (enum) :fallback "-") 128 | (treemacs-create-icon :file "keyword.png" :extensions (keyword) :fallback "-") 129 | (treemacs-create-icon :file "snippet.png" :extensions (snippet) :fallback "-") 130 | (treemacs-create-icon :file "color.png" :extensions (color) :fallback "-") 131 | (treemacs-create-icon :file "file.png" :extensions (file) :fallback "-") 132 | (treemacs-create-icon :file "reference.png" :extensions (reference) :fallback "-") 133 | (treemacs-create-icon :file "folder.png" :extensions (folder) :fallback "-") 134 | (treemacs-create-icon :file "enummember.png" :extensions (enum-member) :fallback "-") 135 | (treemacs-create-icon :file "constant.png" :extensions (constant) :fallback "-") 136 | (treemacs-create-icon :file "struct.png" :extensions (struct) :fallback "-") 137 | (treemacs-create-icon :file "event.png" :extensions (event) :fallback "-") 138 | (treemacs-create-icon :file "operator.png" :extensions (operator) :fallback "-") 139 | (treemacs-create-icon :file "typeparameter.png" :extensions (type-parameter) :fallback "-") 140 | (treemacs-create-icon :file "template.png" :extensions (template) :fallback "-"))) 141 | 142 | (treemacs-create-theme "Netbeans" 143 | :extends "Default" 144 | :icon-directory (f-join (f-dirname (or load-file-name buffer-file-name)) "icons/netbeans") 145 | :config 146 | (progn 147 | (treemacs-create-icon :file "vscode/Namespace.png" :extensions (namespace) :fallback "-") 148 | (treemacs-create-icon :file "text.png" :extensions (text) :fallback "-") 149 | (treemacs-create-icon :file "method.png" :extensions (method) :fallback "-") 150 | (treemacs-create-icon :file "function.png" :extensions (function) :fallback "-") 151 | (treemacs-create-icon :file "constructor.png" :extensions (constructor) :fallback "-") 152 | (treemacs-create-icon :file "field.png" :extensions (field) :fallback "-") 153 | (treemacs-create-icon :file "variable.gif" :extensions (variable) :fallback "-") 154 | (treemacs-create-icon :file "class.png" :extensions (class) :fallback "-") 155 | (treemacs-create-icon :file "interface.png" :extensions (interface) :fallback "-") 156 | (treemacs-create-icon :file "module.png" :extensions (module) :fallback "-") 157 | (treemacs-create-icon :file "property.png" :extensions (property) :fallback "-") 158 | (treemacs-create-icon :file "unit.png" :extensions (unit) :fallback "-") 159 | (treemacs-create-icon :file "value.png" :extensions (value) :fallback "-") 160 | (treemacs-create-icon :file "enum.png" :extensions (enum) :fallback "-") 161 | (treemacs-create-icon :file "keyword.png" :extensions (keyword) :fallback "-") 162 | (treemacs-create-icon :file "snippet.png" :extensions (snippet) :fallback "-") 163 | (treemacs-create-icon :file "color.png" :extensions (color) :fallback "-") 164 | (treemacs-create-icon :file "file.png" :extensions (file) :fallback "-") 165 | (treemacs-create-icon :file "reference.png" :extensions (reference) :fallback "-") 166 | (treemacs-create-icon :file "folder.png" :extensions (folder) :fallback "-") 167 | (treemacs-create-icon :file "enummember.png" :extensions (enum-member) :fallback "-") 168 | (treemacs-create-icon :file "constant.png" :extensions (constant) :fallback "-") 169 | (treemacs-create-icon :file "struct.png" :extensions (struct) :fallback "-") 170 | (treemacs-create-icon :file "event.png" :extensions (event) :fallback "-") 171 | (treemacs-create-icon :file "operator.png" :extensions (operator) :fallback "-") 172 | (treemacs-create-icon :file "typeparameter.png" :extensions (type-parameter) :fallback "-") 173 | (treemacs-create-icon :file "template.png" :extensions (template) :fallback "-"))) 174 | 175 | (treemacs-create-theme "Idea" 176 | :extends "Default" 177 | :icon-directory (f-join (f-dirname (or load-file-name buffer-file-name)) "icons/idea") 178 | :config 179 | (progn 180 | (treemacs-create-icon :file "vscode/template.png" :extensions (template) :fallback "-") 181 | (treemacs-create-icon :file "package.png" :extensions (unknown) :fallback "-") 182 | ;; (treemacs-create-icon :file "misc.png" :extensions (text) :fallback "-") 183 | (treemacs-create-icon :file "method.png" :extensions (method) :fallback "-") 184 | (treemacs-create-icon :file "method.png" :extensions (function) :fallback "-") 185 | (treemacs-create-icon :file "method.png" :extensions (constructor) :fallback "-") 186 | (treemacs-create-icon :file "field.png" :extensions (field) :fallback "-") 187 | (treemacs-create-icon :file "field.png" :extensions (variable) :fallback "-") 188 | (treemacs-create-icon :file "class.png" :extensions (class) :fallback "-") 189 | (treemacs-create-icon :file "interface.png" :extensions (interface) :fallback "-") 190 | (treemacs-create-icon :file "package.png" :extensions (module) :fallback "-") 191 | (treemacs-create-icon :file "property.png" :extensions (property) :fallback "-") 192 | ;; (treemacs-create-icon :file "misc.png" :extensions (unit) :fallback "-") 193 | (treemacs-create-icon :file "field.png" :extensions (value) :fallback "-") 194 | (treemacs-create-icon :file "enum.png" :extensions (enum) :fallback "-") 195 | ;; (treemacs-create-icon :file "misc.png" :extensions (keyword) :fallback "-") 196 | (treemacs-create-icon :file "snippet.png" :extensions (snippet) :fallback "-") 197 | ;; (treemacs-create-icon :file "misc.png" :extensions (color) :fallback "-") 198 | (treemacs-create-icon :file "ppFile.png" :extensions (file) :fallback "-") 199 | (treemacs-create-icon :file "misc.png" :extensions (reference) :fallback "-") 200 | (treemacs-create-icon :file "ppFile.png" :extensions (folder) :fallback "-") 201 | (treemacs-create-icon :file "enum.png" :extensions (enumMember) :fallback "-") 202 | (treemacs-create-icon :file "field.png" :extensions (constant) :fallback "-") 203 | (treemacs-create-icon :file "class.png" :extensions (struct) :fallback "-") 204 | (treemacs-create-icon :file "Event.png" :extensions (event) :fallback "-") 205 | (treemacs-create-icon :file "Misc.png" :extensions (operator) :fallback "-") 206 | ;; (treemacs-create-icon :file "Misc.png" :extensions (operator) :fallback "-") 207 | (treemacs-create-icon :file "Class.png" :extensions (typeParameter) :fallback "-") 208 | (treemacs-create-icon :file "Template.png" :extensions (template) :fallback "-"))) 209 | 210 | (treemacs-create-theme "Iconless" 211 | :icon-directory buffer-file-name) 212 | 213 | (provide 'lsp-treemacs-themes) 214 | ;;; lsp-treemacs-themes.el ends here 215 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /lsp-treemacs.el: -------------------------------------------------------------------------------- 1 | ;;; lsp-treemacs.el --- LSP treemacs -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2019-2024 emacs-lsp maintainers 4 | 5 | ;; Author: Ivan Yonchovski 6 | ;; Keywords: languages 7 | ;; Package-Requires: ((emacs "28.1") (dash "2.18.0") (f "0.20.0") (ht "2.0") (treemacs "2.5") (lsp-mode "6.0")) 8 | ;; Homepage: https://github.com/emacs-lsp/lsp-treemacs 9 | ;; Version: 0.5 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; `lsp-mode' and `treemacs' integration. 27 | 28 | ;;; Code: 29 | 30 | (require 'treemacs) 31 | (require 'treemacs-icons) 32 | (require 'treemacs-treelib) 33 | (require 'lsp-treemacs-generic) 34 | 35 | (require 'lsp-treemacs-themes) 36 | (require 'lsp-mode) 37 | 38 | (defconst lsp-treemacs-deps-buffer-name "*Java Dependency List*") 39 | (defconst lsp-treemacs-symbols-buffer-name "*LSP Symbols List*") 40 | (defconst lsp-treemacs-errors-buffer-name "*LSP Error List*") 41 | 42 | (defgroup lsp-treemacs nil 43 | "Language Server Protocol client." 44 | :group 'tools 45 | :tag "Language Server") 46 | 47 | (defvar lsp-treemacs-deps-position-params 48 | `((side . ,treemacs-position) 49 | (slot . 1) 50 | (window-width . ,treemacs-width)) 51 | "The params which will be used by 52 | `display-buffer-in-side-window' in 53 | `lsp-treemacs-java-deps-list'.") 54 | 55 | (defvar lsp-treemacs-symbols-position-params 56 | `((side . ,treemacs-position) 57 | (slot . 2) 58 | (window-width . ,treemacs-width)) 59 | "The params which will be used by 60 | `display-buffer-in-side-window' in `lsp-treemacs-symbols'.") 61 | 62 | (defvar lsp-treemacs-errors-position-params 63 | `((side . bottom)) 64 | "The params which will be used by 65 | `display-buffer-in-side-window' in 66 | `lsp-treemacs-errors-list'.") 67 | 68 | (defface lsp-treemacs-project-root-error 69 | '((t :inherit font-lock-keyword-face)) 70 | "Face used for highlighting symbols being read." 71 | :group 'lsp-faces) 72 | 73 | (defface lsp-treemacs-project-root-info 74 | '((t :inherit font-lock-keyword-face)) 75 | "Face used for highlighting symbols being read." 76 | :group 'lsp-faces) 77 | 78 | (defface lsp-treemacs-project-root-warn 79 | '((t :inherit font-lock-keyword-face)) 80 | "Face used for highlighting symbols being read." 81 | :group 'lsp-faces) 82 | 83 | (defface lsp-treemacs-file-error 84 | '((t :inherit error)) 85 | "Face used for highlighting symbols being read." 86 | :group 'lsp-faces) 87 | 88 | (defface lsp-treemacs-file-info 89 | '((t :inherit success)) 90 | "Face used for highlighting symbols being read." 91 | :group 'lsp-faces) 92 | 93 | (defface lsp-treemacs-file-hint 94 | '((t :inherit success)) 95 | "Face used for highlighting symbols being read." 96 | :group 'lsp-faces) 97 | 98 | (defface lsp-treemacs-file-warn 99 | '((t :inherit warning)) 100 | "Face used for highlighting symbols being read." 101 | :group 'lsp-faces) 102 | 103 | (defcustom lsp-treemacs-face-map 104 | '((1 . lsp-treemacs-project-root-error) 105 | (2 . lsp-treemacs-project-root-warn) 106 | (3 . lsp-treemacs-project-root-info)) 107 | "Alist diagnostics to face." 108 | :type 'alist) 109 | 110 | (defcustom lsp-treemacs-file-face-map 111 | '((1 . lsp-treemacs-file-error) 112 | (2 . lsp-treemacs-file-warn) 113 | (3 . lsp-treemacs-file-info) 114 | (4 . lsp-treemacs-file-hint)) 115 | "Alist diagnostics to face." 116 | :type 'alist) 117 | 118 | (defcustom lsp-treemacs-error-list-severity 3 119 | "Severity level for `lsp-treemacs-error-list-mode'. 1 (highest) to 3 (lowest)" 120 | :type 'number) 121 | 122 | (defcustom lsp-treemacs-error-list-current-project-only nil 123 | "List the error list of the current project only if available. 124 | Fallback to list all workspaces if no project root is found." 125 | :type 'boolean 126 | :group 'lsp-treemacs) 127 | 128 | (defcustom lsp-treemacs-error-list-expand-depth nil 129 | "Automatic expansion depth for `lsp-treemacs-error-list'." 130 | :type 'number 131 | :group 'lsp-treemacs) 132 | 133 | (defcustom lsp-treemacs-call-hierarchy-expand-depth nil 134 | "Automatic expansion depth for `lsp-treemacs-call-hierarchy'." 135 | :type 'number 136 | :group 'lsp-treemacs) 137 | 138 | (defcustom lsp-treemacs-type-hierarchy-expand-depth nil 139 | "Automatic expansion depth for `lsp-treemacs-type-hierarchy'." 140 | :type 'number 141 | :group 'lsp-treemacs) 142 | 143 | (defcustom lsp-treemacs-java-deps-list-expand-depth nil 144 | "Automatic expansion depth for `lsp-treemacs-java-deps-list'." 145 | :type 'number 146 | :group 'lsp-treemacs) 147 | 148 | (defun lsp-treemacs--open-file-in-mru (file) 149 | (select-window (get-mru-window (selected-frame) nil :not-selected)) 150 | (find-file file)) 151 | 152 | (defun lsp-treemacs-symbol-kind->icon (kind) 153 | (cl-case kind 154 | (1 'document) 155 | (2 'namespace) 156 | (3 'namespace) 157 | (4 'namespace) 158 | (5 'class) 159 | (6 'method) 160 | (7 'property) 161 | (8 'field) 162 | (9 'method) 163 | (10 'enumerator) 164 | (11 'interface) 165 | (12 'method ) 166 | (13 'localvariable) 167 | (14 'constant) 168 | (15 'string) 169 | (16 'numeric) 170 | (17 'boolean-data) 171 | (18 'boolean-data) 172 | (19 'namespace) 173 | (20 'indexer) 174 | (21 'boolean-data) 175 | (22 'enumitem) 176 | (23 'structure) 177 | (24 'event) 178 | (25 'operator) 179 | (26 'template) 180 | (t 'misc))) 181 | 182 | (defun lsp-treemacs-get-icon (icon-name) 183 | "Get the treemacs ICON using current theme." 184 | (treemacs-get-icon-value icon-name nil lsp-treemacs-theme)) 185 | 186 | (defun lsp-treemacs-symbol-icon (kind) 187 | "Get icon for `kind'." 188 | (treemacs-get-icon-value (lsp-treemacs-symbol-kind->icon kind) 189 | nil 190 | lsp-treemacs-theme)) 191 | 192 | (defun lsp-treemacs--symbol-icon (symbol expanded) 193 | "Get the symbol for the the kind." 194 | (-let [(&DocumentSymbol :kind :children?) symbol] 195 | (concat 196 | (if (seq-empty-p children?) 197 | " " 198 | (if expanded "▾ " "▸ ")) 199 | (lsp-treemacs-symbol-icon kind)))) 200 | 201 | (defvar-local lsp-treemacs--symbols nil) 202 | (defvar-local lsp-treemacs--symbols-tick nil) 203 | (defvar-local lsp-treemacs--empty nil) 204 | (defvar-local lsp-treemacs--symbols-state-string nil) 205 | (defvar-local lsp-treemacs--symbols-state-locals nil) 206 | (defvar lsp-treemacs--symbols-current-buffer nil) 207 | (defvar lsp-treemacs--symbols-last-buffer nil) 208 | (defvar lsp-treemacs--symbols-timer nil) 209 | 210 | (defun lsp-treemacs-sort-by-position (left right) 211 | (-let (((&plist :position left-position) left) 212 | ((&plist :position right-position) right)) 213 | (and left-position right-position (lsp--position-compare left-position right-position)))) 214 | 215 | (defun lsp-treemacs-sort-by-kind (left right) 216 | (-let (((&plist :kind left-kind) left) 217 | ((&plist :kind right-kind) right)) 218 | (and left-kind right-kind (> left-kind right-kind)))) 219 | 220 | (defun lsp-treemacs-sort-by-name (left right) 221 | (-let* (((&plist :label left-name) left) 222 | ((&plist :label right-name) right)) 223 | (string> (downcase right-name) (downcase left-name)))) 224 | 225 | (defcustom lsp-treemacs-symbols-sort-functions '(lsp-treemacs-sort-by-position) 226 | "Sort functions." 227 | :type '(repeat 228 | (choice 229 | (const :tag "Name" lsp-treemacs-sort-by-name) 230 | (const :tag "Kind" lsp-treemacs-sort-by-kind) 231 | (const :tag "Position" lsp-treemacs-sort-by-position)))) 232 | 233 | (defcustom lsp-treemacs-detailed-outline t 234 | "Whether `lsp-treemacs-symbols' should include signatures. 235 | For this to work, the language server must support 236 | DocumentSymbols." 237 | :group 'lsp-treemacs 238 | :type 'boolean) 239 | 240 | (defcustom lsp-treemacs-after-jump-hook 241 | (list (lambda () (run-hooks 'xref-after-jump-hook))) 242 | "List of functions to call after jumping to a symbol. 243 | When pressing RET on a symbol in the `lsp-treemacs-symbols' view, 244 | this hook will be run after having jumped to the target." 245 | :group 'lsp-treemacs 246 | :type '(list function)) 247 | 248 | (defmacro lsp-treemacs-define-action (name keys &rest body) 249 | (declare (doc-string 3) (indent 2) (debug (&define name sexp lambda-doc def-body))) 250 | (let* ((docstring (car body))) 251 | (when (stringp docstring) 252 | (pop body)) 253 | `(defun ,name (&rest args) 254 | ,(if (stringp docstring) docstring (format "Code action %s." name)) 255 | (interactive) 256 | (ignore args) 257 | (-if-let (node (treemacs-node-at-point)) 258 | (-let [,(cons '&plist keys) (button-get node :item)] 259 | ,@body) 260 | (treemacs-pulse-on-failure "No node at point"))))) 261 | 262 | (lsp-treemacs-define-action lsp-treemacs-symbols-goto-symbol (:location) 263 | "Goto the symbol node at `point'." 264 | (pop-to-buffer lsp-treemacs--symbols-last-buffer) 265 | (goto-char (lsp--position-to-point location)) 266 | (run-hooks 'lsp-treemacs-after-jump-hook)) 267 | 268 | (lsp-treemacs-define-action lsp-treemacs-go-to (:uri :position) 269 | "Goto POSITION in URL." 270 | (lsp-treemacs--open-file-in-mru (lsp--uri-to-path uri)) 271 | (goto-char (lsp--position-to-point position)) 272 | (run-hooks 'xref-after-jump-hook)) 273 | 274 | (defun lsp-treemacs--symbols->tree (items parent-key) 275 | "Convert ITEMS and PARENT-KEY to a treemacs tree." 276 | (-sort (lambda (left right) 277 | (-first (lambda (fn) 278 | (funcall fn left right)) 279 | lsp-treemacs-symbols-sort-functions)) 280 | (if (-some->> items lsp-seq-first lsp-symbol-information?) 281 | (-let [(current rest) (-separate (-lambda ((&SymbolInformation :container-name?)) 282 | (string= container-name? parent-key)) 283 | (append items nil))] 284 | (seq-map (-lambda ((&SymbolInformation :name :container-name? :kind 285 | :location (location &as &Location :range (&Range :start start-range)))) 286 | (when (string= parent-key container-name?) 287 | `(:label ,name 288 | :key ,name 289 | :icon ,(lsp-treemacs-symbol-kind->icon kind) 290 | ,@(when (-first (-lambda ((&SymbolInformation :container-name? parent)) 291 | (string= name parent)) 292 | rest) 293 | (list :children (lsp-treemacs--symbols->tree rest name))) 294 | :kind ,kind 295 | :location ,start-range 296 | :ret-action lsp-treemacs-symbols-goto-symbol))) 297 | current)) 298 | (seq-map 299 | (-lambda ((sym &as &DocumentSymbol :name :kind :selection-range 300 | (&Range :start start-range) :children?)) 301 | `(:label ,(lsp-render-symbol sym lsp-treemacs-detailed-outline) 302 | :key ,name 303 | :icon ,(lsp-treemacs-symbol-kind->icon kind) 304 | :kind ,kind 305 | :location ,start-range 306 | ,@(unless (seq-empty-p children?) 307 | (list :children (lsp-treemacs--symbols->tree children? name))) 308 | :ret-action lsp-treemacs-symbols-goto-symbol)) 309 | items)))) 310 | 311 | (defun lsp-treemacs--update-symbols () 312 | "After diagnostics handler." 313 | (setq-local header-line-format 314 | (unless lsp-treemacs--symbols 315 | (propertize "No symbol information." 'face 'shadow))) 316 | (lsp-treemacs-render 317 | (lsp-treemacs--symbols->tree 318 | lsp-treemacs--symbols 319 | nil) 320 | " LSP Symbols " 321 | (and lsp-treemacs--symbols (> 30 (length lsp-treemacs--symbols))) 322 | lsp-treemacs-symbols-buffer-name )) 323 | 324 | (defun lsp-treemacs--update () 325 | (unless (eq (current-buffer) (get-buffer "*scratch*")) 326 | (when (with-current-buffer lsp-treemacs-symbols-buffer-name (get-buffer-window)) 327 | (if (lsp--find-workspaces-for "textDocument/documentSymbol") 328 | (when (or (not lsp-treemacs--symbols-tick) 329 | (not (eq lsp-treemacs--symbols-tick (buffer-modified-tick))) 330 | (not (eq (current-buffer) lsp-treemacs--symbols-current-buffer))) 331 | (lsp-request-async "textDocument/documentSymbol" 332 | (lsp-make-document-symbol-params :text-document (lsp--text-document-identifier)) 333 | (lambda (document-symbols) 334 | (save-excursion 335 | (with-current-buffer lsp-treemacs-symbols-buffer-name 336 | (setq-local lsp-treemacs--symbols document-symbols) 337 | (lsp-treemacs--update-symbols)))) 338 | :mode 'alive) 339 | (setq-local lsp-treemacs--symbols-tick (buffer-modified-tick)) 340 | (setq lsp-treemacs--symbols-last-buffer (current-buffer))) 341 | (when (buffer-file-name) 342 | (with-current-buffer lsp-treemacs-symbols-buffer-name 343 | (setq-local lsp-treemacs--symbols nil) 344 | (lsp-treemacs--update-symbols))))) 345 | (setq lsp-treemacs--symbols-current-buffer (current-buffer)))) 346 | 347 | (defun lsp-treemacs-goto-symbol (&rest _) 348 | "Goto the symbol at point." 349 | (interactive) 350 | (if-let ((symbol-data (-some-> (treemacs-node-at-point) 351 | (button-get :symbol)))) 352 | (with-current-buffer lsp-treemacs--symbols-last-buffer 353 | (let ((p (lsp--position-to-point (or (-some->> symbol-data 354 | lsp:document-symbol-selection-range 355 | lsp:range-start) 356 | (-some->> symbol-data 357 | lsp:symbol-information-location 358 | lsp:location-range 359 | lsp:range-start) 360 | (error "Unable to go to location"))))) 361 | (pop-to-buffer lsp-treemacs--symbols-last-buffer) 362 | (goto-char p) 363 | (run-hooks 'xref-after-jump-hook))) 364 | (user-error "No symbol under point."))) 365 | 366 | (with-eval-after-load 'winum 367 | (when (boundp 'winum-ignored-buffers) 368 | (add-to-list 'winum-ignored-buffers lsp-treemacs-symbols-buffer-name) 369 | (add-to-list 'winum-ignored-buffers lsp-treemacs-errors-buffer-name) 370 | (add-to-list 'winum-ignored-buffers lsp-treemacs-deps-buffer-name))) 371 | 372 | (defun lsp-treemacs--expand (root-key depth) 373 | (-when-let (root (treemacs-dom-node->position (treemacs-find-in-dom root-key))) 374 | (treemacs-save-position 375 | (lsp-treemacs--expand-recursively root depth)))) 376 | 377 | (defun lsp-treemacs--kill-symbols-buffer () 378 | (and lsp-treemacs--symbols-timer (cancel-timer lsp-treemacs--symbols-timer))) 379 | 380 | (defcustom lsp-treemacs-symbols-space-between-root-nodes nil 381 | "Whether there should be empty lines between symbols. 382 | If this is set to t, top-level symbols in `lsp-treemacs-symbols' 383 | will be rendered an empty line between them." 384 | :group 'lsp-treemacs 385 | :type 'boolean) 386 | 387 | ;;;###autoload 388 | (defun lsp-treemacs-symbols () 389 | "Show symbols view." 390 | (interactive) 391 | (let ((original-buffer (current-buffer))) 392 | (if-let (buf (get-buffer lsp-treemacs-symbols-buffer-name)) 393 | (select-window (display-buffer-in-side-window buf lsp-treemacs-symbols-position-params)) 394 | (let* ((buf (get-buffer-create lsp-treemacs-symbols-buffer-name)) 395 | (window (display-buffer-in-side-window buf lsp-treemacs-symbols-position-params))) 396 | (select-window window) 397 | (set-window-dedicated-p window t) 398 | 399 | (unless lsp-treemacs--symbols-timer 400 | (setq lsp-treemacs--symbols-timer (run-with-idle-timer 1 t #'lsp-treemacs--update))) 401 | (add-hook 'kill-buffer-hook 'lsp-treemacs--kill-symbols-buffer nil t))) 402 | (with-current-buffer original-buffer (lsp-treemacs--update)))) 403 | 404 | (defun lsp-treemacs--expand-recursively (root depth) 405 | (when (if (booleanp depth) depth (not (zerop depth))) 406 | (save-excursion 407 | (-map 408 | (lambda (btn) 409 | (unless (treemacs-is-node-expanded? btn) 410 | (goto-char (marker-position btn)) 411 | (funcall (alist-get (treemacs-button-get btn :state) treemacs-TAB-actions-config))) 412 | (lsp-treemacs--expand-recursively btn (if (booleanp depth) depth (1- depth)))) 413 | (treemacs-collect-child-nodes root))))) 414 | 415 | 416 | ;; deps 417 | (eval-and-compile 418 | (lsp-interface 419 | (java:Node (:projectUri :rootPath :path :kind :name :uri :entryKind)))) 420 | 421 | (defmacro lsp-treemacs-deps-with-jdtls (&rest body) 422 | "Helper macro for invoking BODY against WORKSPACE context." 423 | (declare (debug (form body)) 424 | (indent 0)) 425 | `(if-let (lsp--cur-workspace (lsp-find-workspace 'jdtls nil)) 426 | (progn ,@body) 427 | (user-error "Java Language Server is not started."))) 428 | 429 | (defun lsp-treemacs-deps--icon (dep) 430 | "Get the symbol for the the kind." 431 | (-let (((&java:Node :uri :kind :entry-kind) dep)) 432 | (if (or (= kind 8) 433 | (= kind 6)) 434 | (f-ext uri) 435 | (cond 436 | ((eq entry-kind 2) 'jar) 437 | ((eq kind 5) 'package) 438 | ((eq kind 7) 'folder) 439 | ((eq kind 4) 'packagefolder) 440 | ((eq kind 2) 'java-project) 441 | ((eq entry-kind 3) 'packagefolder) 442 | ((eq entry-kind 5) 'library))))) 443 | 444 | (defun lsp-treemacs-deps--get-children (dep) 445 | (lsp-treemacs-deps-with-jdtls 446 | (-let* (((&java:Node :project-uri :root-path :path :kind :name :uri) dep) 447 | (project-uri (if (eq kind 2) uri project-uri))) 448 | (unless (or (= kind 6) 449 | (= kind 8)) 450 | (->> (lsp-send-execute-command 451 | "java.getPackageData" 452 | (vector (ht ("kind" kind) 453 | ("path" (unless (eq kind 2) 454 | (if (= 5 kind) 455 | name 456 | path))) 457 | ("rootPath" (unless (eq kind 2) 458 | (or root-path path))) 459 | ("projectUri" project-uri)))) 460 | (-mapcat (lambda (inner-dep) 461 | (lsp-put inner-dep :projectUri project-uri) 462 | (when (= kind 4) 463 | (lsp-put inner-dep :rootPath path)) 464 | (if (eq (lsp-get inner-dep :entryKind) 3) 465 | (lsp-treemacs-deps--get-children inner-dep) 466 | (list inner-dep))))))))) 467 | 468 | (defun lsp-treemacs-deps--java-file? (dep) 469 | (-let [(&java:Node :kind :entry-kind) dep] 470 | (and (eq kind 6) 471 | (or (eq entry-kind 1) 472 | (eq entry-kind 2))))) 473 | 474 | (defun lsp-treemacs-deps--root-folders () 475 | (lsp-treemacs-deps-with-jdtls 476 | (-mapcat (lambda (root-path) 477 | (let ((project-uri (lsp--path-to-uri root-path))) 478 | (->> project-uri 479 | (lsp-send-execute-command "java.project.list") 480 | (--map (--doto it (lsp-put it :projectUri project-uri)))))) 481 | (lsp-session-folders (lsp-session))))) 482 | 483 | (lsp-defun lsp-treemacs-deps--process-dep ((item &as &java:Node :name :uri :path :project-uri)) 484 | `(:label ,name 485 | :icon ,(lsp-treemacs-deps--icon item) 486 | :key ,(list name uri path) 487 | :ret-action ,(lambda (&rest _) 488 | (lsp-treemacs--open-file-in-mru 489 | (or (when uri (lsp--uri-to-path uri)) 490 | (when (f-exists? path) path) 491 | (concat (f-parent (lsp--uri-to-path project-uri)) 492 | path)))) 493 | ,@(unless (lsp-treemacs-deps--java-file? item) 494 | (list :children 495 | (lambda (_) 496 | (-map #'lsp-treemacs-deps--process-dep 497 | (lsp-treemacs-deps--get-children item))))))) 498 | ;;;###autoload 499 | (defun lsp-treemacs-java-deps-list () 500 | "Display java dependencies." 501 | (interactive) 502 | (select-window 503 | (display-buffer-in-side-window 504 | (lsp-treemacs-render 505 | (-map 'lsp-treemacs-deps--process-dep (lsp-treemacs-deps--root-folders)) 506 | "*Java Deps*" lsp-treemacs-java-deps-list-expand-depth) 507 | lsp-treemacs-deps-position-params))) 508 | 509 | (defun lsp-treemacs--deps-find-children-for-key (node key) 510 | (->> node 511 | treemacs-collect-child-nodes 512 | (-first (lambda (child) 513 | (goto-char (marker-position child)) 514 | (equal (treemacs-button-get child :key) key))))) 515 | 516 | (defvar lsp-treemacs-deps-list-mode-map 517 | (let ((m (make-sparse-keymap))) 518 | (define-key m (kbd "r") #'lsp-treemacs-generic-refresh) 519 | m) 520 | "Keymap for `lsp-treemacs-deps-list-mode'.") 521 | 522 | (define-minor-mode lsp-treemacs-deps-list-mode "LSP Treemacs mode for listing dependencies." 523 | :keymap lsp-treemacs-deps-list-mode-map 524 | :group 'lsp-treemacs) 525 | 526 | ;;;###autoload 527 | (defun lsp-treemacs-java-deps-follow () 528 | (interactive) 529 | (lsp-treemacs-deps-with-jdtls 530 | (let ((paths (lsp-send-execute-command "java.resolvePath" 531 | (lsp--buffer-uri)))) 532 | (select-window 533 | (with-current-buffer lsp-treemacs-deps-buffer-name 534 | (set-window-point 535 | (get-buffer-window) 536 | (marker-position 537 | (-reduce-from 538 | (-lambda (node (&java:Node :path :name :uri)) 539 | (unless (treemacs-is-node-expanded? node) 540 | (save-excursion 541 | (goto-char (marker-position node)) 542 | (funcall (alist-get (treemacs-button-get node :state) treemacs-TAB-actions-config)))) 543 | (or (lsp-treemacs--deps-find-children-for-key node (list name uri path)) 544 | (user-error "Unable to find %s in the dependency tree." (buffer-name)))) 545 | (treemacs-dom-node->position (treemacs-find-in-dom '(:custom LSP-Java-Dependency))) 546 | paths))) 547 | (get-buffer-window))) 548 | (recenter nil)))) 549 | 550 | 551 | ;; treemacs synchronization 552 | 553 | (defun lsp-treemacs--on-folder-remove (project) 554 | (lsp-workspace-folders-remove (treemacs-project->path project))) 555 | 556 | (defun lsp-treemacs--on-folder-added (project) 557 | (lsp-workspace-folders-add (treemacs-project->path project))) 558 | 559 | (defun lsp-treemacs--treemacs->lsp () 560 | (let ((lsp-folders (lsp-session-folders (lsp-session))) 561 | (treemacs-folders (->> (treemacs-current-workspace) 562 | (treemacs-workspace->projects) 563 | (-map #'treemacs-project->path) 564 | (-map #'lsp-canonical-file-name)))) 565 | (seq-do #'lsp-workspace-folders-remove (-difference lsp-folders treemacs-folders)) 566 | (seq-do #'lsp-workspace-folders-add (-difference treemacs-folders lsp-folders)))) 567 | 568 | (defun lsp-treemacs--sync-folders (added removed) 569 | (when-let (treemacs-workspace (treemacs-current-workspace)) 570 | (let ((treemacs-create-project-functions (remove #'lsp-treemacs--on-folder-added 571 | treemacs-create-project-functions)) 572 | (treemacs-delete-project-functions (remove #'lsp-treemacs--on-folder-remove 573 | treemacs-delete-project-functions)) 574 | (added (seq-map #'treemacs--canonical-path added)) 575 | (removed (seq-map #'treemacs--canonical-path removed))) 576 | (dolist (added-path added) 577 | (unless (treemacs-is-path added-path :in-workspace treemacs-workspace) 578 | (let* ((name (file-name-nondirectory (directory-file-name added-path))) 579 | (result (treemacs-do-add-project-to-workspace added-path name))) 580 | (unless (eq 'success result) 581 | (lsp-log "Failed to add path '%s' to treemacs' workspace: %s" added-path result))))) 582 | (dolist (removed-path removed) 583 | (when (treemacs-is-path removed-path :in-workspace treemacs-workspace) 584 | (let ((result (treemacs-do-remove-project-from-workspace removed-path))) 585 | (unless (eq 'success result) 586 | (lsp-log "Failed to remove path '%s' from treemacs' workspace: %s" removed-path result)))))))) 587 | 588 | ;;;###autoload 589 | (define-minor-mode lsp-treemacs-sync-mode 590 | "Global minor mode for synchronizing lsp-mode workspace folders and 591 | treemacs projects." 592 | :init-value nil 593 | :group 'lsp-treemacs 594 | :global t 595 | (cond 596 | (lsp-treemacs-sync-mode 597 | (add-hook 'treemacs-create-project-functions #'lsp-treemacs--on-folder-added) 598 | (add-hook 'treemacs-delete-project-functions #'lsp-treemacs--on-folder-remove) 599 | (add-hook 'lsp-workspace-folders-changed-functions #'lsp-treemacs--sync-folders) 600 | (add-hook 'treemacs-workspace-edit-hook #'lsp-treemacs--treemacs->lsp) 601 | (add-hook 'treemacs-switch-workspace-hook #'lsp-treemacs--treemacs->lsp)) 602 | (t 603 | (remove-hook 'treemacs-create-project-functions #'lsp-treemacs--on-folder-added) 604 | (remove-hook 'treemacs-delete-project-functions #'lsp-treemacs--on-folder-remove) 605 | (remove-hook 'lsp-workspace-folders-changed-functions #'lsp-treemacs--sync-folders) 606 | (remove-hook 'treemacs-workspace-edit-hook #'lsp-treemacs--treemacs->lsp) 607 | (remove-hook 'treemacs-switch-workspace-hook #'lsp-treemacs--treemacs->lsp)))) 608 | 609 | 610 | 611 | (defun lsp-treemacs--java-get-class-file (file) 612 | (-let (((_ _package _class jar-file) (s-match "jdt://contents/.*\/\\(.*\\)\/\\(.*\\).class\\?=.*?/\\(.*?\\)=\/" file))) 613 | (symbol-name (read (url-unhex-string jar-file ))))) 614 | 615 | (defun lsp-treemacs--get-xrefs-in-file (file-locs location-link) 616 | (-let (((filename . links) file-locs)) 617 | (list :key filename 618 | :label (format (propertize "%s %s" 'face 'default) 619 | (propertize (f-filename filename) 'face 'default) 620 | (propertize (format "%s references" (length links)) 'face 'lsp-details-face)) 621 | :icon (f-ext filename) 622 | :children (lambda (_item) 623 | (condition-case err 624 | (let ((buf (find-buffer-visiting filename)) 625 | (fn (lambda () 626 | (seq-map (lambda (loc) 627 | (lsp-treemacs--make-ref-item 628 | (if location-link 629 | (or (lsp:location-link-target-selection-range loc) 630 | (lsp:location-link-target-range loc)) 631 | (lsp:location-range loc)) 632 | filename)) 633 | links)))) 634 | (if buf 635 | (with-current-buffer buf 636 | (funcall fn)) 637 | (when (file-readable-p filename) 638 | (with-temp-buffer 639 | (insert-file-contents-literally filename) 640 | (funcall fn))))) 641 | (error (ignore (lsp-warn 642 | "Failed to process xref entry for filename '%s': %s" 643 | filename 644 | (error-message-string err)))) 645 | (file-error (ignore (lsp-warn 646 | "Failed to process xref entry, file-error, '%s': %s" 647 | filename 648 | (error-message-string err)))))) 649 | :ret-action (lambda (&rest _) 650 | (interactive) 651 | (lsp-treemacs--open-file-in-mru filename))))) 652 | 653 | (defun lsp-treemacs--extract-line (point) 654 | "Return the line pointed to by POS (a Position object) in the current buffer." 655 | (let* ((inhibit-field-text-motion t)) 656 | (save-excursion 657 | (goto-char point) 658 | (buffer-substring (line-beginning-position) 659 | (line-end-position))))) 660 | 661 | (lsp-defun lsp-treemacs--make-ref-item ((&Range :start (start &as &Position :line start-line :character start-character) 662 | :end (&Position :character end-character)) 663 | filename) 664 | "Return a xref-item from a RANGE in FILENAME." 665 | (-let* ((start-point (lsp--position-to-point start)) 666 | (line (lsp-treemacs--extract-line start-point)) 667 | (len (length line))) 668 | (add-face-text-property (max (min start-character len) 0) 669 | (max (min end-character len) 0) 670 | 'highlight t line) 671 | ;; LINE is nil when FILENAME is not being current visited by any buffer. 672 | (list :label (s-trim (format "%s %s" 673 | line 674 | (propertize(format "%s line" 675 | (1+ start-line)) 676 | 'face 'lsp-details-face))) 677 | :key line 678 | :point start-point 679 | :icon-literal "" 680 | :ret-action (lambda (&rest _) 681 | (interactive) 682 | (lsp-treemacs--open-file-in-mru filename) 683 | (goto-char start-point) 684 | (run-hooks 'xref-after-jump-hook))))) 685 | 686 | (defun lsp-treemacs--handle-references (refs) 687 | (->> refs 688 | (-group-by (-lambda ((&Location :uri)) 689 | (let ((type (url-type (url-generic-parse-url (url-unhex-string uri))))) 690 | (if (string= type "jdt") 691 | (lsp-treemacs--java-get-class-file uri) 692 | (lsp-workspace-root (lsp--uri-to-path uri)))))) 693 | (-map (-lambda ((path . rst)) 694 | (list :key path 695 | :label (format 696 | "%s %s" 697 | (f-filename path) 698 | (propertize (format "%s references" (length rst)) 'face 'lsp-details-face)) 699 | :icon (if (f-file? path) 700 | (f-ext path) 701 | 'dir-open) 702 | :children (lambda (_item) 703 | (-map (lambda (it) 704 | (lsp-treemacs--get-xrefs-in-file it nil)) 705 | (-group-by (-lambda ((&Location :uri)) 706 | (lsp--uri-to-path uri)) 707 | rst))) 708 | :ret-action (lambda (&rest _) 709 | (interactive) 710 | (lsp-treemacs--open-file-in-mru path))))))) 711 | 712 | (defun lsp-treemacs--set-mode-line-format (buffer title) 713 | "Set the mode line format of BUFFER to TITLE. 714 | This function sets the `mode-name' or `mode-line-format' 715 | depending on if a custom mode line is detected." 716 | (with-current-buffer buffer 717 | (cond ((or (fboundp 'spaceline-install) 718 | (memq 'moody-mode-line-buffer-identification 719 | (default-value 'mode-line-format)) 720 | (and (fboundp 'doom-modeline) 721 | (fboundp 'doom-modeline-def-modeline))) 722 | (setq mode-name title)) 723 | (t 724 | (setq mode-line-format title))))) 725 | 726 | (defun lsp-treemacs--do-search (method params title prefix-args) 727 | (let ((search-buffer (get-buffer-create "*LSP Lookup*")) 728 | (window (display-buffer (get-buffer-create "*LSP Lookup*")))) 729 | (lsp-request-async 730 | method 731 | params 732 | (lambda (refs) 733 | (lsp-treemacs--set-mode-line-format search-buffer " Rendering results... ") 734 | (lsp-with-cached-filetrue-name 735 | (let ((lsp-file-truename-cache (ht))) 736 | (lsp-treemacs-render (lsp-treemacs--handle-references refs) 737 | (format title (length refs)) 738 | (and prefix-args (not (equal prefix-args 0)))))) 739 | (lsp--info "Refresh completed!")) 740 | :mode 'detached 741 | :cancel-token :treemacs-lookup) 742 | 743 | (unless (equal prefix-args 0) 744 | (select-window window) 745 | ;; (set-window-dedicated-p window t) 746 | ) 747 | 748 | (with-current-buffer search-buffer 749 | (lsp-treemacs--set-mode-line-format search-buffer " Loading... ") 750 | (setq-local lsp-treemacs-tree nil) 751 | (lsp-treemacs-generic-refresh)))) 752 | 753 | ;;;###autoload 754 | (defun lsp-treemacs-references (arg) 755 | "Show the references for the symbol at point. 756 | With a prefix argument, select the new window and expand the tree of 757 | references automatically." 758 | (interactive "P") 759 | (lsp-treemacs--do-search 760 | "textDocument/references" 761 | `(:context (:includeDeclaration t) ,@(lsp--text-document-position-params)) 762 | " Found %s references " 763 | arg)) 764 | 765 | ;;;###autoload 766 | (defun lsp-treemacs-implementations (arg) 767 | "Show the implementations for the symbol at point. 768 | With a prefix argument, select the new window expand the tree of 769 | implementations automatically." 770 | (interactive "P") 771 | (lsp-treemacs--do-search "textDocument/implementation" 772 | (lsp--text-document-position-params) 773 | " Found %s implementations " 774 | arg)) 775 | 776 | 777 | ;; Call hierarchy. 778 | 779 | (lsp-defun lsp-treemacs--call-hierarchy-ret-action ((&CallHierarchyItem :uri :selection-range (&Range :start))) 780 | "Build the ret action for a call hierarchy item using URI and START range." 781 | (lsp-treemacs--open-file-in-mru (lsp--uri-to-path uri)) 782 | (goto-char (lsp--position-to-point start)) 783 | (run-hooks 'xref-after-jump-hook)) 784 | 785 | (defun lsp-treemacs--call-hierarchy-children (buffer method outgoing node callback) 786 | (-let [item (plist-get node :item)] 787 | (with-current-buffer buffer 788 | (lsp-request-async 789 | method 790 | (list :item item) 791 | (lambda (result) 792 | (funcall 793 | callback 794 | (seq-map 795 | (-lambda (node) 796 | (-let* (((child-item &as &CallHierarchyItem :_name :kind :_detail? :_uri :selection-range (&Range :_start)) 797 | (if outgoing 798 | (lsp:call-hierarchy-outgoing-call-to node) 799 | (lsp:call-hierarchy-incoming-call-from node))) 800 | (label (lsp-render-symbol child-item t))) 801 | (list :label label 802 | :key label 803 | :icon (lsp-treemacs-symbol-kind->icon kind) 804 | :children-async (-partial #'lsp-treemacs--call-hierarchy-children buffer method outgoing) 805 | :ret-action (lambda (&rest _) 806 | (interactive) 807 | (lsp-treemacs--call-hierarchy-ret-action child-item)) 808 | :item child-item))) 809 | result))) 810 | :mode 'detached)))) 811 | 812 | ;;;###autoload 813 | (defun lsp-treemacs-call-hierarchy (outgoing) 814 | "Show the incoming call hierarchy for the symbol at point. 815 | With a prefix argument, show the outgoing call hierarchy." 816 | (interactive "P") 817 | (unless (lsp-feature? "textDocument/prepareCallHierarchy") 818 | (user-error "Call hierarchy not supported by the current servers: %s" 819 | (-map #'lsp--workspace-print (lsp-workspaces)))) 820 | (let ((buffer (current-buffer))) 821 | (select-window 822 | (display-buffer-in-side-window 823 | (lsp-treemacs-render 824 | (seq-map 825 | (-lambda ((item &as &CallHierarchyItem :kind :name)) 826 | (list :label (lsp-render-symbol item t) 827 | :key name 828 | :icon (lsp-treemacs-symbol-kind->icon kind) 829 | :children-async (-partial 830 | #'lsp-treemacs--call-hierarchy-children 831 | buffer 832 | (if outgoing 833 | "callHierarchy/outgoingCalls" 834 | "callHierarchy/incomingCalls") 835 | outgoing) 836 | :ret-action (lambda (&rest _) 837 | (interactive) 838 | (lsp-treemacs--call-hierarchy-ret-action item)) 839 | :item item)) 840 | (lsp-request "textDocument/prepareCallHierarchy" 841 | (lsp--text-document-position-params))) 842 | (concat (if outgoing "Outgoing" "Incoming") " Call Hierarchy") 843 | lsp-treemacs-call-hierarchy-expand-depth "*Call Hierarchy*" nil t) nil)))) 844 | 845 | 846 | 847 | ;; Type hierarchy. 848 | 849 | (defconst lsp-treemacs--hierarchy-sub 0) 850 | (defconst lsp-treemacs--hierarchy-super 1) 851 | (defconst lsp-treemacs--hierarchy-both 2) 852 | 853 | (defun lsp-treemacs--type-hierarchy-render-nodes (result loaded? &optional direction) 854 | (-map (-lambda ((it &as &TypeHierarchyItem :name :kind :uri :range (&Range :start) :children? :parents?)) 855 | `(:label ,(concat name (cond 856 | ((eq lsp-treemacs--hierarchy-sub direction) (propertize " ↓" 'face 'shadow)) 857 | ((eq lsp-treemacs--hierarchy-super direction) (propertize " ↑" 'face 'shadow)))) 858 | :key ,name 859 | :icon ,(lsp-treemacs-symbol-kind->icon kind) 860 | ,@(if loaded? 861 | (list :children (append 862 | (lsp-treemacs--type-hierarchy-render-nodes children? nil lsp-treemacs--hierarchy-sub) 863 | (lsp-treemacs--type-hierarchy-render-nodes parents? nil lsp-treemacs--hierarchy-super))) 864 | (list :children-async (-partial #'lsp-treemacs--type-hierarchy-render 865 | it 866 | direction))) 867 | :ret-action ,(lambda (&rest _) 868 | (interactive) 869 | (lsp-treemacs--open-file-in-mru (lsp--uri-to-path uri)) 870 | (goto-char (lsp--position-to-point start)) 871 | (run-hooks 'xref-after-jump-hook)))) 872 | result)) 873 | 874 | (lsp-defun lsp-treemacs--type-hierarchy-render ((&TypeHierarchyItem :uri :range (&Range :start)) direction _ callback) 875 | (lsp-request-async 876 | "textDocument/typeHierarchy" 877 | (lsp-make-type-hierarchy-params :text-document (lsp-make-text-document-item :uri uri) 878 | :position start 879 | :direction direction 880 | :resolve 1) 881 | (-lambda ((&TypeHierarchyItem :children? :parents?)) 882 | (funcall callback (lsp-treemacs--type-hierarchy-render-nodes 883 | (if (eq direction lsp-treemacs--hierarchy-sub) 884 | children? 885 | parents?) 886 | nil direction))))) 887 | 888 | ;;;###autoload 889 | (defun lsp-treemacs-type-hierarchy (direction) 890 | "Show the type hierarchy for the symbol at point. 891 | With prefix 0 show sub-types. 892 | With prefix 1 show super-types. 893 | With prefix 2 show both." 894 | (interactive "P") 895 | (unless (lsp--find-workspaces-for "textDocument/typeHierarchy") 896 | (user-error "Type hierarchy not supported by the current servers: %s" 897 | (-map #'lsp--workspace-print (lsp-workspaces)))) 898 | (setq direction (or direction 0)) 899 | (let ((workspaces (lsp-workspaces)) 900 | (result (lsp-request 901 | "textDocument/typeHierarchy" 902 | (-> (lsp--text-document-position-params) 903 | (plist-put :direction direction) 904 | (plist-put :resolve 1))))) 905 | (if result 906 | (pop-to-buffer 907 | (lsp-treemacs-render 908 | (lsp-treemacs--type-hierarchy-render-nodes (vector result) t) 909 | (concat (cond 910 | ((eq lsp-treemacs--hierarchy-sub direction) "Sub") 911 | ((eq lsp-treemacs--hierarchy-super direction) "Super") 912 | ((eq lsp-treemacs--hierarchy-both direction) "Sub/Super")) 913 | " Type Hierarchy") 914 | lsp-treemacs-type-hierarchy-expand-depth 915 | "*lsp-treemacs-call-hierarchy*")) 916 | (user-error "No class under point.")) 917 | (setq lsp--buffer-workspaces workspaces))) 918 | 919 | 920 | ;; errors 921 | 922 | (defun lsp-treemacs--error-list-diags (_folder file &rest _) 923 | (->> (lsp-diagnostics) 924 | (gethash file) 925 | (-filter #'lsp-treemacs--match-diagnostic-severity) 926 | (-sort (-lambda ((&Diagnostic :range (&Range :start (&Position :character char-a 927 | :line line-a))) 928 | (&Diagnostic :range (&Range :start (&Position :character char-b 929 | :line line-b)))) 930 | (if (= line-a line-b) 931 | (< char-a char-b) 932 | (< line-a line-b)))) 933 | (-map (-lambda ((diag &as &Diagnostic 934 | :severity? 935 | :message 936 | :range (&Range :start (start &as &Position :line :character)) 937 | :source?)) 938 | (list :id message 939 | :label (format (propertize "%s %s %s" 'face 'default) 940 | (if source? 941 | (propertize (format "[%s]" source?) 942 | 'face 'shadow) 943 | "") 944 | (string-join (mapcar #'string-trim (string-lines message)) ", ") 945 | (propertize (format "(%s:%s)" line character) 946 | 'face 'lsp-details-face)) 947 | :icon-literal (lsp-treemacs--diagnostic-icon severity?) 948 | :ret-action (lambda (&rest _) 949 | (lsp-treemacs--open-file-in-mru file) 950 | (->> start 951 | lsp--position-to-point 952 | goto-char) 953 | (run-hooks 'xref-after-jump-hook)) 954 | :file file 955 | :diag diag 956 | :actions `(["Quick fix..." lsp-treemacs-list-errors-quick-fix ] 957 | ["Go to..." lsp-treemacs-list-errors-quick-fix ])))))) 958 | 959 | (defun lsp-treemacs-errors--list-files (folder &rest _) 960 | (->> (lsp-diagnostics) 961 | (ht-keys) 962 | (-keep 963 | (lambda (file) 964 | (if (and (lsp-f-ancestor-of? folder file) 965 | (lsp-treemacs-errors--diags? (lsp-diagnostics-stats-for file))) 966 | (list (list :id file 967 | :label (format "%s %s %s" 968 | (f-filename file) 969 | (->> (append (lsp-diagnostics-stats-for file) ()) 970 | (-map-indexed 971 | (lambda (index count) 972 | (unless (zerop count) 973 | (propertize 974 | (number-to-string count) 975 | 'face (alist-get index lsp-treemacs-file-face-map))))) 976 | (-filter #'identity) 977 | (s-join "/")) 978 | (propertize (f-dirname (f-relative file folder)) 979 | 'face 'lsp-details-face)) 980 | :icon (if (f-directory? file) 'dir-closed (f-ext file)) 981 | :children (-partial #'lsp-treemacs--error-list-diags folder file) 982 | :ret-action (lambda (&rest _) 983 | (interactive) 984 | (lsp-treemacs--open-file-in-mru file)))) 985 | (if (lsp-f-same? folder file) 986 | (lsp-treemacs--error-list-diags folder file))))) 987 | ;; for each file we have a list with a single plist that expands, 988 | ;; and for the folder list with zero or more plists with folder-level 989 | ;; errors. flatten the list of lists of plists into a list of plists 990 | (-flatten-n 1))) 991 | 992 | (lsp-treemacs-define-action lsp-treemacs-quick-fix (:file :diag) 993 | "Select the element under cursor." 994 | (lsp-treemacs--open-file-in-mru file) 995 | (-let [(&Diagnostic :range (&RangeToPoint :start)) diag] 996 | (goto-char start) 997 | (call-interactively #'lsp-execute-code-action))) 998 | 999 | (defun lsp-treemacs-cycle-severity () 1000 | "Cycle through the severity levels shown in the errors list" 1001 | (interactive) 1002 | (setq lsp-treemacs-error-list-severity 1003 | (if (= lsp-treemacs-error-list-severity lsp/diagnostic-severity-error) 1004 | lsp/diagnostic-severity-hint 1005 | (1- lsp-treemacs-error-list-severity))) 1006 | (lsp-treemacs-errors-list--refresh)) 1007 | 1008 | (defun lsp-treemacs-errors--diags? (diags) 1009 | (->> diags 1010 | (seq-map-indexed (lambda (count index) 1011 | (when (and (not (zerop count)) 1012 | (<= index lsp-treemacs-error-list-severity)) 1013 | count))) 1014 | (seq-some #'identity))) 1015 | 1016 | (defun lsp-treemacs--build-error-list (folder) 1017 | (when-let ((diags (append (lsp-diagnostics-stats-for folder) ()))) 1018 | (when (lsp-treemacs-errors--diags? diags) 1019 | (list :label (format 1020 | (propertize "%s %s %s" 'face 'default) 1021 | (f-filename folder) 1022 | (->> diags 1023 | (-map-indexed 1024 | (lambda (index count) 1025 | (when (and (not (zerop count)) 1026 | (<= index lsp-treemacs-error-list-severity)) 1027 | (propertize 1028 | (number-to-string count) 1029 | 'face (alist-get index lsp-treemacs-file-face-map))))) 1030 | (-filter #'identity) 1031 | (s-join "/")) 1032 | (propertize (f-dirname folder) 1033 | 'face 'lsp-lens-face)) 1034 | :id folder 1035 | :icon 'root 1036 | :children (-partial #'lsp-treemacs-errors--list-files folder) 1037 | :ret-action (lambda (&rest _) 1038 | (interactive) 1039 | (lsp-treemacs--open-file-in-mru folder)))))) 1040 | 1041 | (defvar lsp-treemacs--current-workspaces nil) 1042 | 1043 | (defun lsp-treemacs-errors-list--refresh () 1044 | (lsp-treemacs-render 1045 | (if (and lsp-treemacs-error-list-current-project-only 1046 | lsp-treemacs--current-workspaces) 1047 | (->> lsp-treemacs--current-workspaces 1048 | (-map #'lsp-workspace-folders) 1049 | (-flatten) 1050 | (-keep #'lsp-treemacs--build-error-list)) 1051 | (->> (lsp-session) 1052 | (lsp-session-folders) 1053 | (-keep #'lsp-treemacs--build-error-list))) 1054 | "Errors List" 1055 | lsp-treemacs-error-list-expand-depth 1056 | lsp-treemacs-errors-buffer-name 1057 | `(["Cycle Severity" lsp-treemacs-cycle-severity]))) 1058 | 1059 | ;;;###autoload 1060 | (defun lsp-treemacs-errors-list () 1061 | (interactive) 1062 | (setq lsp-treemacs--current-workspaces (lsp-workspaces)) 1063 | (-if-let (buffer (get-buffer lsp-treemacs-errors-buffer-name)) 1064 | (progn 1065 | (select-window (display-buffer-in-side-window buffer lsp-treemacs-errors-position-params)) 1066 | (lsp-treemacs-errors-list--refresh)) 1067 | (let* ((buffer (lsp-treemacs-errors-list--refresh)) 1068 | (window (display-buffer-in-side-window buffer lsp-treemacs-errors-position-params))) 1069 | (select-window window) 1070 | (set-window-dedicated-p window t) 1071 | (lsp-treemacs-error-list-mode 1) 1072 | 1073 | (add-hook 'lsp-diagnostics-updated-hook #'lsp-treemacs-errors-list--refresh) 1074 | (add-hook 'kill-buffer-hook 'lsp-treemacs--kill-buffer nil t))) 1075 | 1076 | (let ((buf (lsp-treemacs-errors-list--refresh))) 1077 | (pop-to-buffer buf) 1078 | (with-current-buffer buf 1079 | (lsp-treemacs-error-list-mode 1)))) 1080 | 1081 | (defun lsp-treemacs--diagnostic-icon (severity) 1082 | "Get the icon for DIAGNOSTIC." 1083 | (cl-case severity 1084 | (1 treemacs-icon-error) 1085 | (2 treemacs-icon-warning) 1086 | (t treemacs-icon-info))) 1087 | 1088 | (defun lsp-treemacs--kill-buffer () 1089 | "Kill buffer hook." 1090 | (remove-hook 'lsp-diagnostics-updated-hook #'lsp-treemacs-errors-list--refresh)) 1091 | 1092 | (defvar lsp-treemacs-error-list-mode-map 1093 | (let ((m (make-sparse-keymap))) 1094 | (define-key m (kbd "x") #'lsp-treemacs-quick-fix) 1095 | (define-key m (kbd "=") #'lsp-treemacs-cycle-severity) 1096 | m) 1097 | "Keymap for `lsp-treemacs-error-list-mode'.") 1098 | 1099 | (define-minor-mode lsp-treemacs-error-list-mode "LSP Treemacs mode for listing errors." 1100 | :keymap lsp-treemacs-error-list-mode-map 1101 | :group 'lsp-treemacs) 1102 | 1103 | (defun lsp-treemacs--match-diagnostic-severity (diagnostic) 1104 | (<= (lsp:diagnostic-severity? diagnostic) 1105 | (prefix-numeric-value lsp-treemacs-error-list-severity))) 1106 | 1107 | (provide 'lsp-treemacs) 1108 | ;;; lsp-treemacs.el ends here 1109 | 1110 | ;; Local Variables: 1111 | ;; flycheck-disabled-checkers: (emacs-lisp-checkdoc) 1112 | ;; End: 1113 | --------------------------------------------------------------------------------