|
| 1 | +*clapi.txt* Class API viewer for Neovim |
| 2 | + |
| 3 | +============================================================================== |
| 4 | +CONTENTS *clapi-contents* |
| 5 | + |
| 6 | + 1. Introduction ........................... |clapi-introduction| |
| 7 | + 2. Requirements ........................... |clapi-requirements| |
| 8 | + 3. Installation ........................... |clapi-installation| |
| 9 | + 4. Usage .................................. |clapi-usage| |
| 10 | + 5. Configuration .......................... |clapi-configuration| |
| 11 | + 6. Commands ............................... |clapi-commands| |
| 12 | + 7. API .................................... |clapi-api| |
| 13 | + 8. Supported Languages .................... |clapi-languages| |
| 14 | + 9. Examples ............................... |clapi-examples| |
| 15 | + 10. About .................................. |clapi-about| |
| 16 | + |
| 17 | +============================================================================== |
| 18 | +1. INTRODUCTION *clapi-introduction* |
| 19 | + |
| 20 | +CLAPI (Class API) is a telescope.nvim extension that provides enhanced document |
| 21 | +symbol navigation with visibility modifiers (public, protected, private). This |
| 22 | +makes it easier to browse and understand class interfaces. |
| 23 | + |
| 24 | +The plugin analyzes the entire class/module hierarchy, including parent classes, |
| 25 | +traits, interfaces, and other inherited elements, giving you a complete view of |
| 26 | +the available API surface. |
| 27 | + |
| 28 | +While the built-in telescope.nvim document symbols picker doesn't include |
| 29 | +visibility modifiers, clapi adds them to the display, allowing you to quickly |
| 30 | +see which methods and properties are part of the public API of your classes. |
| 31 | + |
| 32 | +============================================================================== |
| 33 | +2. REQUIREMENTS *clapi-requirements* |
| 34 | + |
| 35 | +The following dependencies are required: |
| 36 | + |
| 37 | + - nvim-telescope/telescope.nvim |
| 38 | + - nvim-treesitter/nvim-treesitter |
| 39 | + - nvim-lua/plenary.nvim |
| 40 | + - LSP server configured for your language |
| 41 | + |
| 42 | +============================================================================== |
| 43 | +3. INSTALLATION *clapi-installation* |
| 44 | + |
| 45 | +Using lazy.nvim: >lua |
| 46 | + { |
| 47 | + 'markelca/clapi.nvim', |
| 48 | + dependencies = { |
| 49 | + 'nvim-telescope/telescope.nvim', |
| 50 | + 'nvim-treesitter/nvim-treesitter', |
| 51 | + 'nvim-lua/plenary.nvim', |
| 52 | + }, |
| 53 | + config = function() |
| 54 | + -- Enable the clapi extension |
| 55 | + pcall(require('telescope').load_extension('clapi')) |
| 56 | + |
| 57 | + -- Optionally set up a keymap |
| 58 | + vim.keymap.set('n', '<leader>sa', require('clapi').builtin, |
| 59 | + { desc = '[S]earch [A]pi' }) |
| 60 | + |
| 61 | + -- Configure the extension |
| 62 | + require('telescope').setup { |
| 63 | + extensions = { |
| 64 | + clapi = {}, |
| 65 | + }, |
| 66 | + } |
| 67 | + end, |
| 68 | + } |
| 69 | +< |
| 70 | + |
| 71 | +============================================================================== |
| 72 | +4. USAGE *clapi-usage* |
| 73 | + |
| 74 | +After installation, you can use the picker with one of the following methods: |
| 75 | + |
| 76 | +Command: > |
| 77 | + :Telescope clapi |
| 78 | +< |
| 79 | + |
| 80 | +Lua: > |
| 81 | + :lua require('clapi').builtin() |
| 82 | +< |
| 83 | + |
| 84 | +Or using your configured keymap (if set). |
| 85 | + |
| 86 | +When the picker opens, you can: |
| 87 | +- Navigate through the list of class members and methods |
| 88 | +- See the visibility (public, protected, private) of each item |
| 89 | +- Browse the complete class hierarchy including inherited members from parent classes, |
| 90 | + traits, and interfaces |
| 91 | +- Type to filter |
| 92 | +- Press <Enter> to jump to the selected item |
| 93 | + |
| 94 | +============================================================================== |
| 95 | +5. CONFIGURATION *clapi-configuration* |
| 96 | + |
| 97 | +The clapi picker accepts the following options: |
| 98 | + |
| 99 | + - `bufnr`: Buffer number (defaults to current buffer) |
| 100 | + - `path_display`: How to display paths |
| 101 | + - `entry_maker`: Custom entry maker function |
| 102 | + |
| 103 | +Example configuration: >lua |
| 104 | + require('telescope').setup { |
| 105 | + extensions = { |
| 106 | + clapi = { |
| 107 | + -- Default configuration options |
| 108 | + }, |
| 109 | + }, |
| 110 | + } |
| 111 | +< |
| 112 | + |
| 113 | +============================================================================== |
| 114 | +6. COMMANDS *clapi-commands* |
| 115 | + |
| 116 | +*:Telescope clapi* |
| 117 | + Opens the class API picker for the current buffer. |
| 118 | + |
| 119 | +============================================================================== |
| 120 | +7. API *clapi-api* |
| 121 | + |
| 122 | +*require('clapi').builtin([opts])* |
| 123 | + |
| 124 | +Opens the telescope picker with module interface. |
| 125 | + |
| 126 | +Parameters: |
| 127 | + - `opts` (table, optional): Configuration options |
| 128 | + - `bufnr` (number, optional): Buffer number, defaults to current buffer (0) |
| 129 | + - `path_display` (table|string, optional): How to display paths |
| 130 | + - `entry_maker` (function, optional): Custom entry maker function |
| 131 | + |
| 132 | +Returns: nil |
| 133 | + |
| 134 | +============================================================================== |
| 135 | +8. SUPPORTED LANGUAGES *clapi-languages* |
| 136 | + |
| 137 | +Currently supported languages: |
| 138 | + - PHP |
| 139 | + - Java |
| 140 | + |
| 141 | +============================================================================== |
| 142 | +9. EXAMPLES *clapi-examples* |
| 143 | + |
| 144 | +Basic usage: >lua |
| 145 | + -- Map a key to open the API picker |
| 146 | + vim.keymap.set('n', '<leader>sa', require('clapi').builtin, |
| 147 | + { desc = '[S]earch [A]pi' }) |
| 148 | +< |
| 149 | + |
| 150 | +Advanced usage with custom options: >lua |
| 151 | + -- Open the API picker with specific options |
| 152 | + require('clapi').builtin({ |
| 153 | + path_display = { "smart" } |
| 154 | + }) |
| 155 | +< |
| 156 | + |
| 157 | +============================================================================== |
| 158 | +10. ABOUT *clapi-about* |
| 159 | + |
| 160 | +clapi.nvim is developed by Markel Cuesta |
| 161 | +GitHub: https://github.com/markelca/clapi.nvim |
| 162 | + |
| 163 | +For issues and feature requests, please visit: |
| 164 | +https://github.com/markelca/clapi.nvim/issues |
| 165 | + |
| 166 | +============================================================================== |
| 167 | + vim:tw=78:ts=8:ft=help:norl: |
0 commit comments