| 972 | |
| 973 | |
| 974 | class WillSaveFeature extends DocumentNotifiactions<WillSaveTextDocumentParams, TextDocumentWillSaveEvent> { |
| 975 | |
| 976 | constructor(client: BaseLanguageClient) { |
| 977 | super( |
| 978 | client, Workspace.onWillSaveTextDocument, WillSaveTextDocumentNotification.type, |
| 979 | client.clientOptions.middleware!.willSave, |
| 980 | (willSaveEvent) => client.code2ProtocolConverter.asWillSaveTextDocumentParams(willSaveEvent), |
| 981 | (selectors, willSaveEvent) => DocumentNotifiactions.textDocumentFilter(selectors, willSaveEvent.document) |
| 982 | ) |
| 983 | } |
| 984 | |
| 985 | public get messages(): RPCMessageType { |
| 986 | return WillSaveTextDocumentNotification.type; |
| 987 | } |
| 988 | |
| 989 | public fillClientCapabilities(capabilities: ClientCapabilities): void { |
| 990 | let value = ensure(ensure(capabilities, 'textDocument')!, 'synchronization')!; |
| 991 | value.willSave = true; |
| 992 | } |
| 993 | |
| 994 | public initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void { |
| 995 | let textDocumentSyncOptions = (capabilities as ResolvedTextDocumentSyncCapabilities).resolvedTextDocumentSync; |
| 996 | if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.willSave) { |
| 997 | this.register(this.messages, { |
| 998 | id: UUID.generateUuid(), |
| 999 | registerOptions: { documentSelector: documentSelector } |
| 1000 | }); |
| 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | class WillSaveWaitUntilFeature implements DynamicFeature<TextDocumentRegistrationOptions> { |
| 1006 |
nothing calls this directly
no outgoing calls
no test coverage detected