🎉 initiate project *astro_rewrite*
This commit is contained in:
		
							parent
							
								
									ffd4d5e86c
								
							
						
					
					
						commit
						2ba37bfbe3
					
				
					 8658 changed files with 2268794 additions and 2538 deletions
				
			
		
							
								
								
									
										51
									
								
								node_modules/vscode-html-languageservice/lib/esm/services/htmlRename.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								node_modules/vscode-html-languageservice/lib/esm/services/htmlRename.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| /*--------------------------------------------------------------------------------------------- | ||||
|  *  Copyright (c) Microsoft Corporation. All rights reserved. | ||||
|  *  Licensed under the MIT License. See License.txt in the project root for license information. | ||||
|  *--------------------------------------------------------------------------------------------*/ | ||||
| export function doRename(document, position, newName, htmlDocument) { | ||||
|     const offset = document.offsetAt(position); | ||||
|     const node = htmlDocument.findNodeAt(offset); | ||||
|     if (!node.tag) { | ||||
|         return null; | ||||
|     } | ||||
|     if (!isWithinTagRange(node, offset, node.tag)) { | ||||
|         return null; | ||||
|     } | ||||
|     const edits = []; | ||||
|     const startTagRange = { | ||||
|         start: document.positionAt(node.start + '<'.length), | ||||
|         end: document.positionAt(node.start + '<'.length + node.tag.length) | ||||
|     }; | ||||
|     edits.push({ | ||||
|         range: startTagRange, | ||||
|         newText: newName | ||||
|     }); | ||||
|     if (node.endTagStart) { | ||||
|         const endTagRange = { | ||||
|             start: document.positionAt(node.endTagStart + '</'.length), | ||||
|             end: document.positionAt(node.endTagStart + '</'.length + node.tag.length) | ||||
|         }; | ||||
|         edits.push({ | ||||
|             range: endTagRange, | ||||
|             newText: newName | ||||
|         }); | ||||
|     } | ||||
|     const changes = { | ||||
|         [document.uri.toString()]: edits | ||||
|     }; | ||||
|     return { | ||||
|         changes | ||||
|     }; | ||||
| } | ||||
| function toLocString(p) { | ||||
|     return `(${p.line}, ${p.character})`; | ||||
| } | ||||
| function isWithinTagRange(node, offset, nodeTag) { | ||||
|     // Self-closing tag
 | ||||
|     if (node.endTagStart) { | ||||
|         if (node.endTagStart + '</'.length <= offset && offset <= node.endTagStart + '</'.length + nodeTag.length) { | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
|     return node.start + '<'.length <= offset && offset <= node.start + '<'.length + nodeTag.length; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 sindrekjelsrud
						sindrekjelsrud