-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the workspace/foldingRange/refresh method (#1309)
* Add the workspace/foldingRange/refresh method * Add proposed tag * Move refreshSupport to workspace scoped capability --------- Co-authored-by: Dirk Bäumer <dirkb@microsoft.com>
- Loading branch information
Showing
6 changed files
with
158 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
'use strict'; | ||
|
||
import { FoldingRange, Disposable, FoldingRangeParams, FoldingRangeRefreshRequest, FoldingRangeRequest } from 'vscode-languageserver-protocol'; | ||
|
||
import type { Feature, _Languages, ServerRequestHandler } from './server'; | ||
|
||
/** | ||
* Shape of the folding range feature | ||
*/ | ||
export interface FoldingRangeFeatureShape { | ||
foldingRange: { | ||
/** | ||
* Ask the client to refresh all folding ranges | ||
* | ||
* @since 3.18.0. | ||
* @proposed | ||
*/ | ||
refresh(): Promise<void>; | ||
|
||
/** | ||
* Installs a handler for the folding range request. | ||
* | ||
* @param handler The corresponding handler. | ||
*/ | ||
on(handler: ServerRequestHandler<FoldingRangeParams, FoldingRange[] | undefined | null, FoldingRange[], void>): Disposable; | ||
}; | ||
} | ||
|
||
export const FoldingRangeFeature: Feature<_Languages, FoldingRangeFeatureShape> = (Base) => { | ||
return class extends Base implements FoldingRangeFeatureShape { | ||
public get foldingRange() { | ||
return { | ||
refresh: (): Promise<void> => { | ||
return this.connection.sendRequest(FoldingRangeRefreshRequest.type); | ||
}, | ||
on: (handler: ServerRequestHandler<FoldingRangeParams, FoldingRange[] | undefined | null, FoldingRange[], void>): Disposable => { | ||
const type = FoldingRangeRequest.type; | ||
return this.connection.onRequest(type, (params, cancel) => { | ||
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); | ||
}); | ||
} | ||
}; | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters