1import{_ as e,c as s,e as a,o as t}from"./app-CjUkjRdW.js";const p="/assets/rename-dialog-TT_4V6y7.png",o="/assets/renamed-identifier-BfyZrU8P.png",l="/assets/inplace-rename-B4jybu-H.png",c="/assets/inplace-rename-string-BMdeu-1c.png",i="/assets/inplace-rename-string-occ-E8YNGe6N.png",r={};function d(u,n){return t(),s("div",null,n[0]||(n[0]=[a(`<h1 id="rename-refactoring" tabindex="-1"><a class="header-anchor" href="#rename-refactoring"><span>Rename Refactoring</span></a></h1><p>Now that we have support for scope-based reference resolution, let's add support for rename refactoring. This will allow users to rename a symbol and have all references to that symbol updated automatically.</p><h2 id="supporting-rename" tabindex="-1"><a class="header-anchor" href="#supporting-rename"><span>Supporting Rename</span></a></h2><p>The IDE supports rename refactoring for elements that implement the <code>PsiNamedElement</code> interface by calling their <code>setName</code> method. This method should create a new identifier element with the new name, and replace the existing identifier element with the new one.</p><p>Creating a new identifier element is not straightforward, as it requires creating a new <code>PsiElement</code> instance backed by a new <code>ASTNode</code>. We'll need to create a dummy <code>PsiFile</code> from a text fragment that contains the new identifier, let the IDE parse the file, and extract the identifier element from the resulting <code>PsiFile</code>.</p><p>Let's create a <code>NimElementFactory</code> class that will help us create new elements. We'll add a pair of <code>createIdentDecl</code> and <code>createIdentRef</code> methods to create new identifier declarations and references, respectively. We will use the former in the <code>setName</code> method of our <code>IdentDecl</code> element, and the latter in the <code>handleElementRename</code> method of our <code>IdentReference</code> element.</p><div class="language-kotlin line-numbers-mode" data-highlighter="prismjs" data-ext="kt" data-title="kt"><pre><code><span class="line"><span class="token comment">// src/main/kotlin/khaledh/nimjet/psi/NimElementFactory.kt</span></span> 2<span class="line"><span class="token operator">..</span><span class="token punctuation">.</span></span> 3<span class="line"></span> 4<span class="line"><span class="token keyword">class</span> NimElementFactory <span class="token punctuation">{</span></span> 5<span class="line"></span> 6<span class="line"> <span class="token keyword">companion</span> <span class="token keyword">object</span> <span class="token punctuation">{</span></span> 7<span class="line"></span> 8<span class="line"> <span class="token keyword">private</span> <span class="token keyword">fun</span> <span class="token function">createFile</span><span class="token punctuation">(</span>project<span class="token operator">:</span> Project<span class="token punctuation">,</span> text<span class="token operator">:</span> String<span class="token punctuation">)</span><span class="token operator">:</span> NimFile <span class="token punctuation">{</span></span> 9<span class="line"> <span class="token keyword">return</span> PsiFileFactory</span> 10<span class="line"> <span class="token punctuation">.</span><span class="token function">getInstance</span><span class="token punctuation">(</span>project<span class="token punctuation">)</span></span> 11<span class="line"> <span class="token punctuation">.</span><span class="token function">createFileFromText</span><span class="token punctuation">(</span><span class="token string-literal singleline"><span class="token string">"dummy.nim"</span></span><span class="token punctuation">,</span> NimFileType<span class="token punctuation">,</span> text<span class="token punctuation">)</span> <span class="token keyword">as</span> NimFile</span> 12<span class="line"> <span class="token punctuation">}</span></span> 13<span class="line"></span> 14<span class="line"> <span class="token keyword">fun</span> <span class="token function">createIdentDecl</span><span class="token punctuation">(</span>project<span class="token operator">:</span> Project<span class="token punctuation">,</span> name<span class="token operator">:</span> String<span class="token punctuation">)</span><span class="token operator">:</span> IdentDecl <span class="token punctuation">{</span></span> 15<span class="line">
15 <span class="token keyword">val</span> file <span class="token operator">=</span> <span class="token function">createFile</span><span class="token punctuation">(</span>project<span class="token punctuation">,</span> <span class="token string-literal singleline"><span class="token string">"let </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">$</span><span class="token expression">name</span></span><span class="token string"> = \\"\\""</span></span><span class="token punctuation">)</span></span> 16<span class="line"> <span class="token keyword">return</span> PsiTreeUtil<span class="token punctuation">.</span><span class="token function">findChildOfType</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> IdentDecl<span class="token operator">::</span><span class="token keyword">class</span><span class="token punctuation">.</span>java<span class="token punctuation">)</span></span> 17<span class="line"> <span class="token operator">?:</span> <span class="token keyword">throw</span> <span class="token function">IncorrectOperationException</span><span class="token punctuation">(</span><span class="token string-literal singleline"><span class="token string">"Failed to create new IdentDecl element"</span></span><span class="token punctuation">)</span></span> 18<span class="line"> <span class="token punctuation">}</span></span> 19<span class="line"></span> 20<span class="line"> <span class="token keyword">fun</span> <span class="token function">createIdentRef</span><span class="token punctuation">(</span>project<span class="token operator">:</span> Project<span class="token punctuation">,</span> name<span class="token operator">:</span> String<span class="token punctuation">)</span><span class="token operator">:</span> IdentRef <span class="token punctuation">{</span></span> 21<span class="line"> <span class="token keyword">val</span> file <span class="token operator">=</span> <span class="token function">createFile</span><span class="token punctuation">(</span>project<span class="token punctuation">,</span> <span class="token string-literal singleline"><span class="token string">"</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">$</span><span class="token expression">name</span></span><span class="token string"> dummy"</span></span><span class="token punctuation">)</span></span> 22<span class="line"> <span class="token keyword">return</span> PsiTreeUtil<span class="token punctuation">.</span><span class="token function">findChildOfType</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> IdentRef<span class="token operator">::</span><span class="token keyword">class</span><span class="token punctuation">.</span>java<span class="token punctuation">)</span></span> 23<span class="line"> <span class="token operator">?:</span> <span class="token keyword">throw</span> <span class="token function">IncorrectOperationException</span><span class="token punctuation">(</span><span class="token string-literal singleline"><span class="token string">"Failed to create new IdentRef element"</span></span><span class="token punctuation">)</span></span> 24<span class="line"> <span class="token punctuation">}</span></span> 25<span class="line"></span> 26<span class="line"> <span class="token punctuation">}</span></span> 27<span class="line"><span class="token punctuation">}</span></span> 28<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The <code>createFile</code> method creates a new <code>NimFile</code> instance from a text fragment. The <code>createIdentDecl</code> method uses this method to create a new file containing the fragment <code>let $name = ""</code>, where <code>$name</code> is the new identifier name. This creates a new identifier declaration element with the specified name. We then extract the <code>IdentDecl</code> element from the file and return it.</p><p>The <code>createIdentRef</code> method is similar, but it creates a file containing the fragment <code>$name dummy</code>, where <code>$name</code> is the new identifier name. This creates a new identifier reference element, which we extract and return.</p><p>Now, let's use the <code>createIdentDecl</code> method in the <code>IdentDeclMixin</code> class to implement the <code>setName</code> method.</p><div class="language-kotlin line-numbers-mode" data-highlighter="prismjs" data-ext="kt" data-title="kt"><pre><code><span class="line"><span class="token comment">// src/main/kotlin/khaledh/nimjet/psi/impl/IdentDeclMixin.kt</span></span> 29<span class="line"><span class="token operator">..</span><span class="token punctuation">.</span></span> 30<span class="line"></span> 31<span class="line"><span class="token keyword">abstract</span> <span class="token keyword">class</span> <span class="token function">IdentDeclMixin</span><span class="token punctuation">(</span>node<span class="token operator">:</span> ASTNode<span class="token punctuation">)</span> <span class="token operator">:</span> <span class="token function">ASTWrapperPsiElement</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">,</span> IdentDecl <span class="token punctuation">{</span></span> 32<span class="line"> <span class="token operator">..</span><span class="token punctuation">.</span></span> 33<span class="line"></span> 34<span class="line"> <span class="token keyword">
34override</span> <span class="token keyword">fun</span> <span class="token function">setName</span><span class="token punctuation">(</span>name<span class="token operator">:</span> String<span class="token punctuation">)</span><span class="token operator">:</span> PsiElement <span class="token punctuation">{</span></span> 35<span class="line"> <span class="token keyword">val</span> newIdentDecl <span class="token operator">=</span> NimElementFactory<span class="token punctuation">.</span><span class="token function">createIdentDecl</span><span class="token punctuation">(</span>project<span class="token punctuation">,</span> name<span class="token punctuation">)</span></span> 36<span class="line"> ident<span class="token punctuation">.</span><span class="token function">replace</span><span class="token punctuation">(</span>newIdentDecl<span class="token punctuation">.</span>ident<span class="token punctuation">)</span></span> 37<span class="line"> <span class="token keyword">return</span> <span class="token keyword">this</span></span> 38<span class="line"> <span class="token punctuation">}</span></span> 39<span class="line"></span> 40<span class="line"> <span class="token operator">..</span><span class="token punctuation">.</span></span> 41<span class="line"><span class="token punctuation">}</span></span> 42<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>After we create the new <code>IdentDecl</code> element, we replace the existing identifier token (the <code>ident</code> property) with the new <code>ident</code> token from the new declaration. This updates the identifier name in the declaration.</p><p>Now, let's implement the <code>handleElementRename</code> method in the <code>IdentReferenceMixin</code> class to rename references to the identifier.</p><div class="language-kotlin line-numbers-mode" data-highlighter="prismjs" data-ext="kt" data-title="kt"><pre><code><span class="line"><span class="token comment">// src/main/kotlin/khaledh/nimjet/psi/IdentReference.kt</span></span> 43<span class="line"><span class="token operator">..</span><span class="token punctuation">.</span></span> 44<span class="line"></span> 45<span class="line"><span class="token keyword">class</span> <span class="token function">IdentReference</span><span class="token punctuation">(</span>element<span class="token operator">:</span> IdentRef<span class="token punctuation">,</span> textRange<span class="token operator">:</span> TextRange<span class="token punctuation">)</span></span> 46<span class="line"> <span class="token operator">:</span> PsiReferenceBase<span class="token operator"><</span>IdentRef<span class="token operator">></span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> textRange<span class="token punctuation">)</span> <span class="token punctuation">{</span></span> 47<span class="line"> <span class="token operator">..</span><span class="token punctuation">.</span></span> 48<span class="line"></span> 49<span class="line"> <span class="token keyword">override</span> <span class="token keyword">fun</span> <span class="token function">handleElementRename</span><span class="token punctuation">(</span>newElementName<span class="token operator">:</span> String<span class="token punctuation">)</span><span class="token operator">:</span> PsiElement <span class="token punctuation">{</span></span> 50<span class="line"> <span class="token keyword">val</span> newIdentRef <span class="token operator">=</span> NimElementFactory<span class="token punctuation">.</span><span class="token function">createIdentRef</span><span class="token punctuation">(</span>myElement<span class="token punctuation">.</span>project<span class="token punctuation">,</span> newElementName<span class="token punctuation">)</span></span> 51<span class="line"> myElement<span class="token punctuation">.</span>ident<span class="token punctuation">.</span><span class="token function">replace</span><span class="token punctuation">(</span>newIdentRef<span class="token punctuation">.</span>ident<span class="token punctuation">)</span></span> 52<span class="line">
52 <span class="token keyword">return</span> myElement</span> 53<span class="line"> <span class="token punctuation">}</span></span> 54<span class="line"></span> 55<span class="line"> <span class="token operator">..</span><span class="token punctuation">.</span></span> 56<span class="line"><span class="token punctuation">}</span></span> 57<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>This time we create a new <code>IdentRef</code> element using the <code>createIdentRef</code> method and replace the existing identifier token with the new one. Notice that <code>IdentReference</code> is a <code>PsiReference</code> object, not the <code>IdentRef</code> element itself. We use the <code>myElement</code> property to access the <code>IdentRef</code> element.</p><p>This should be enough to support rename refactoring. Let's try it out by putting the cursor on the inner declaration of the <code>msg</code> variable and pressing <code>Shift + F6</code> to rename it. We can also right-click on the declaration and select <code>Refactor -> Rename... </code> from the context menu.</p><p><img src="`+p+'" alt="Rename Dialog" width="600"></p><p>The IDE shows a dialog where we can enter the new name. We enter <code>innerMsg</code> and press <code>Enter</code>. The IDE updates the declaration and all references to the variable.</p><p><img src="'+o+`" alt="Renamed Identifier" width="350"></p><p>Great! Both the inner declaration and the reference to the variable have been updated.</p><h2 id="in-place-rename" tabindex="-1"><a class="header-anchor" href="#in-place-rename"><span>In-place Rename</span></a></h2><p>The IDE also supports in-place rename refactoring, where we can rename an identifier directly in the editor, instead of using the dialog. This feature relies on registering a class that extends <code>RefactoringSupportProvider</code> and registering it in the <code>plugin.xml</code>. This class enables many refactoring features (e.g. rename, introduce variable, extract method, etc.), but we'll focus only on the rename refactoring for now.</p><p>Let's create a <code>NimRefactoringSupportProvider</code> class and override the <code>isInplaceRenameAvailable</code> method to enable in-place rename refactoring.</p><div class="language-kotlin line-numbers-mode" data-highlighter="prismjs" data-ext="kt" data-title="kt"><pre><code><span class="line"><span class="token comment">// src/main/kotlin/khaledh/nimjet/refactoring/NimRefactoringSupportProvider.kt</span></span> 58<span class="line"><span class="token operator">..</span><span class="token punctuation">.</span></span> 59<span class="line"></span> 60<span class="line"><span class="token keyword">class</span> NimRefactoringSupportProvider <span class="token operator">:</span> <span class="token function">RefactoringSupportProvider</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span> 61<span class="line"></span> 62<span class="line"> <span class="token keyword">override</span> <span class="token keyword">fun</span> <span class="token function">isInplaceRenameAvailable</span><span class="token punctuation">(</span>element<span class="token operator">:</span> PsiElement<span class="token punctuation">,</span> context<span class="token operator">:</span> PsiElement<span class="token operator">?</span><span class="token punctuation">)</span><span class="token operator">:</span> Boolean <span class="token punctuation">{</span></span> 63<span class="line"> <span class="token keyword">return</span> element<span class="token punctuation">.</span>useScope <span class="token keyword">is</span> LocalSearchScope</span> 64<span class="line"> <span class="token punctuation">}</span></span> 65<span class="line"></span> 66<span class="line"><span class="token punctuation">}</span></span> 67<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The IDE has two handlers for in-place rename refactoring: local and global.</p><ul><li>The local one is <code>VariableInplaceRenameHandler</code>, and it requires the element to have a <code>LocalSearchScope</code> use scope. Local search scope is typically associated with local variables (which include variables at the file scope that are not exported), and function parameters. This handler passes the element to our <code>isInplaceRenameAvailable</code> method to determine if in-place rename is available for that element.</li><li>The global one is <code>MemberInplaceRenameHandler</code>, and it can handle elements with a <code>GlobalSearchScope</code> use scope. This scope is typically associated with public classes, functions, variables, and other symbols that can be accessed from other files. This handler passes the element to the <code>isMemberInplaceRenameAvailable</code> method of the <code>RefactoringSupportProvider</code> class to check if in-place rename is available for that element.</li></ul><p>In our case, we only need the local in-place rename handler, so we override only the <code>isInplaceRenameAvailable</code> method. For this to work though, we need to modify our <code>IdentDecl</code> element to have a <code>LocalSearchScope</code> use scope. Let's do that in the <code>IdentDeclMixin</code> class.</p><div class="language-kotlin line-numbers-mode" data-highlighter="prismjs" data-ext="kt" data-title="kt"><pre><code><span class="line"><span class="token operator">..</span><span class="token punctuation">.</span></span> 68<span class="line"></span> 69<span class="line"><span class="token keyword">abstract</span> <span class="token keyword">class</span> <span class="token function">IdentDeclMixin</span><span class="token punctuation">(</span>node<span class="token operator">:</span> ASTNode<span class="token punctuation">)</span> <span class="token operator">:</span> <span class="token function">ASTWrapperPsiElement</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">,</span> IdentDecl <span class="token punctuation">{</span></span> 70<span class="line"> <span class="token operator">..</span><span class="token punctuation">.</span></span> 71<span class="line"></span> 72<span class="line"> <span class="token keyword">
72override</span> <span class="token keyword">fun</span> <span class="token function">getContext</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> PsiElement<span class="token operator">?</span> <span class="token operator">=</span> NimScope<span class="token punctuation">.</span><span class="token function">parentScope</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span></span> 73<span class="line"></span> 74<span class="line"> <span class="token keyword">override</span> <span class="token keyword">fun</span> <span class="token function">getUseScope</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> SearchScope <span class="token operator">=</span> <span class="token function">LocalSearchScope</span><span class="token punctuation">(</span>context <span class="token operator">?:</span> containingFile<span class="token punctuation">)</span></span> 75<span class="line"></span> 76<span class="line"><span class="token punctuation">}</span></span> 77<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The <code>getUseScope</code> method returns a <code>LocalSearchScope</code> constrained to the element's parent context, or the containing file if the context is null. This limits the scope of the in-place rename refactoring to the element's scope.</p><p>Finally, let's register the <code>NimRefactoringSupportProvider</code> class in the <code>plugin.xml</code> file.</p><div class="language-xml line-numbers-mode" data-highlighter="prismjs" data-ext="xml" data-title="xml"><pre><code><span class="line"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>idea-plugin</span><span class="token punctuation">></span></span></span> 78<span class="line"> ...</span> 79<span class="line"></span> 80<span class="line"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>extensions</span> <span class="token attr-name">defaultExtensionNs</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>com.intellij<span class="token punctuation">"</span></span><span class="token punctuation">></span></span></span> 81<span class="line"> ...</span> 82<span class="line"></span> 83<span class="line"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>lang.refactoringSupport</span></span> 84<span class="line"> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Nim<span class="token punctuation">"</span></span></span> 85<span class="line"> <span class="token attr-name">implementationClass</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>khaledh.nimjet.refactoring.NimRefactoringSupportProvider<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span></span> 86<span class="line"></span> 87<span class="line"> <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>extensions</span><span class="token punctuation">></span></span></span> 88<span class="line"></span> 89<span class="line"><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>idea-plugin</span><span class="token punctuation">></span></span></span> 90<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="testing-in-place-rename" tabindex="-1"><a class="header-anchor" href="#testing-in-place-rename"><span>Testing In-place Rename</span></a></h2><p>Let's test the in-place rename refactoring by putting the cursor on the <code>msg</code> variable declaration in the block scope and pressing <code>Shift + F6</code>. Both the declaration and the reference to the variable should become editable with a purple background. If we start typing, the IDE should update the declaration and all references to the variable in sync.</p><p><img src="`+l+'" alt="In-place Rename" width="420"></p><p>Looks good! Now, let's try to rename the other <code>msg</code> variable declaration (at the file scope). Notice that I changed the string literal value to <code>"msg"</code> as well. When we start the in-place renaming, the IDE will show a popover to ask if we want to rename the occurrences in the string literal as well.</p><p><img src="'+c+'" alt="In-Place Rename String Occurrences" width="430"></p><p>Let's choose <strong>Rename all occurrences</strong>
90 and start typing. The IDE should update all occurrences of the variable, including the string literal. Neat!</p><p><img src="'+i+'" alt="In-Place Rename String Occurrences" width="400"></p><p>That's it for rename refactoring. In the next section, we'll add support for <strong>Find Usages</strong>, which will allow us to find all references to a symbol and display the results in a tool window.</p>',39)]))}const k=e(r,[["render",d],["__file","10-rename-refactoring.html.vue"]]),h=JSON.parse(`{"path":"/nimjet/10-rename-refactoring.html","title":"Rename Refactoring","lang":"en-US","frontmatter":{},"headers":[{"level":2,"title":"Supporting Rename","slug":"supporting-rename","link":"#supporting-rename","children":[]},{"level":2,"title":"In-place Rename","slug":"in-place-rename","link":"#in-place-rename","children":[]},{"level":2,"title":"Testing In-place Rename","slug":"testing-in-place-rename","link":"#testing-in-place-rename","children":[]}],"git":{"updatedTime":1727231650000},"filePathRelative":"nimjet/10-rename-refactoring.md","excerpt":"\\n<p>Now that we have support for scope-based reference resolution, let's add support for\\nrename refactoring. This will allow users to rename a symbol and have all references to\\nthat symbol updated automatically.</p>\\n<h2>Supporting Rename</h2>\\n<p>The IDE supports rename refactoring for elements that implement the <code>PsiNamedElement</code>\\ninterface by calling their <code>setName</code> method. This method should create a new identifier\\nelement with the new name, and replace the existing identifier element with the new one.</p>"}`);export{k as comp,h as data};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.