From 48fe0dd4f629bb1282277ba8a6757a84c13a4dda Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 14 Nov 2020 10:41:51 +0000 Subject: [PATCH] Update documentation for code actions and rename --- README.md | 13 +++++++++++++ doc/ale.txt | 25 ++++++++++++++++++------- plugin/ale.vim | 1 + 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0f1c613b..69ff33ae 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ other content at [w0rp.com](https://w0rp.com). 5. [Find References](#usage-find-references) 6. [Hovering](#usage-hover) 7. [Symbol Search](#usage-symbol-search) + 8. [Refactoring: Rename, Actions](#usage-refactoring) 3. [Installation](#installation) 1. [Installation with Vim package management](#standard-installation) 2. [Installation with Pathogen](#installation-with-pathogen) @@ -253,6 +254,18 @@ similar to a given query string. See `:help ale-symbol-search` for more information. + + +### 2.viii Refactoring: Rename, Actions + +ALE supports renaming symbols in symbols in code such as variables or class +names with the `ALERename` command. + +`ALECodeAction` will execute actions on the cursor or applied to a visual +range selection, such as automatically fixing errors. + +See `:help ale-refactor` for more information. + ## 3. Installation diff --git a/doc/ale.txt b/doc/ale.txt index 4263f698..013b39f9 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -20,6 +20,7 @@ CONTENTS *ale-contents* 5.4 Find References...................|ale-find-references| 5.5 Hovering..........................|ale-hover| 5.6 Symbol Search.....................|ale-symbol-search| + 5.7 Refactoring: Rename, Actions......|ale-refactor| 6. Global Options.......................|ale-options| 6.1 Highlights........................|ale-highlights| 7. Linter/Fixer Options.................|ale-integration-options| @@ -669,6 +670,16 @@ ALE supports searching for workspace symbols via LSP linters with the |ALESymbolSearch| command. See the documentation for the command for a full list of options. +------------------------------------------------------------------------------- +5.7 Refactoring: Rename, Actions *ale-refactor* + +ALE supports renaming symbols in symbols in code such as variables or class +names with the |ALERename| command. + +|ALECodeAction| will execute actions on the cursor or applied to a visual +range selection, such as automatically fixing errors. + + =============================================================================== 6. Global Options *ale-options* @@ -3108,14 +3119,14 @@ ALERename *ALERename* ALECodeAction *ALECodeAction* - Code Actions support for `tsserver`. + Apply a code action via LSP servers or `tsserver`. - There are two different kind of actions supported for `tsserver`. If run in - normal mode then code fix will be attempted if there is error in that line. - If there are multiple code fixes available use will be shown input to choose - one. In visual mode `tsserver` will be queries for applicable refactors - (e.g. extract to constant or extract to function) and user will be given - choice to select the one he/she likes. + If there is an error present on a line that can be fixed, ALE will + automatically fix a line, unless there are multiple possible code fixes to + apply. + + This command can be run in visual mode apply actions, such as applicable + refactors. A menu will be shown to select code action to apply. ALERepeatSelection *ALERepeatSelection* diff --git a/plugin/ale.vim b/plugin/ale.vim index 7472ea8c..c5c1d3d3 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -240,6 +240,7 @@ command! -bar ALEImport :call ale#completion#Import() " Rename symbols using tsserver and LSP command! -bar -bang ALERename :call ale#rename#Execute({'force_save': '' is# '!'}) +" Apply code actions to a range. command! -bar -range ALECodeAction :call ale#codefix#Execute() " Organize import statements using tsserver