@@ -14,7 +14,8 @@ import {
1414 CompletionItemKind ,
1515 TextEdit ,
1616 Range ,
17- WorkspaceEdit
17+ WorkspaceEdit ,
18+ LinkedEditingRanges
1819} from 'vscode-languageserver' ;
1920import {
2021 DocumentManager ,
@@ -24,10 +25,16 @@ import {
2425} from '../../lib/documents' ;
2526import { LSConfigManager , LSHTMLConfig } from '../../ls-config' ;
2627import { svelteHtmlDataProvider } from './dataProvider' ;
27- import { HoverProvider , CompletionsProvider , RenameProvider } from '../interfaces' ;
28+ import {
29+ HoverProvider ,
30+ CompletionsProvider ,
31+ RenameProvider ,
32+ LinkedEditingRangesProvider
33+ } from '../interfaces' ;
2834import { isInsideMoustacheTag , toRange } from '../../lib/documents/utils' ;
2935
30- export class HTMLPlugin implements HoverProvider , CompletionsProvider , RenameProvider {
36+ export class HTMLPlugin
37+ implements HoverProvider , CompletionsProvider , RenameProvider , LinkedEditingRangesProvider {
3138 private configManager : LSConfigManager ;
3239 private lang = getLanguageService ( {
3340 customDataProviders : [ svelteHtmlDataProvider ] ,
@@ -210,6 +217,7 @@ export class HTMLPlugin implements HoverProvider, CompletionsProvider, RenamePro
210217 if ( ! this . featureEnabled ( 'renameTags' ) ) {
211218 return null ;
212219 }
220+
213221 const html = this . documents . get ( document ) ;
214222 if ( ! html ) {
215223 return null ;
@@ -248,6 +256,25 @@ export class HTMLPlugin implements HoverProvider, CompletionsProvider, RenamePro
248256 return toRange ( document . getText ( ) , tagNameStart , tagNameStart + node . tag . length ) ;
249257 }
250258
259+ getLinkedEditingRanges ( document : Document , position : Position ) : LinkedEditingRanges | null {
260+ if ( ! this . featureEnabled ( 'linkedEditing' ) ) {
261+ return null ;
262+ }
263+
264+ const html = this . documents . get ( document ) ;
265+ if ( ! html ) {
266+ return null ;
267+ }
268+
269+ const ranges = this . lang . findLinkedEditingRanges ( document , position , html ) ;
270+
271+ if ( ! ranges ) {
272+ return null ;
273+ }
274+
275+ return { ranges } ;
276+ }
277+
251278 /**
252279 *
253280 * The language service is case insensitive, and would provide
0 commit comments