 the bootstrapping of the cluster
 */
struct BootstrapClusterRequest {
  /**
   * The metadata replication property that this cluster will have. This will
   * be used to provision the initial metadata nodeset.
   */
  1: common.ReplicationProperty metadata_replication_property,
}

struct BootstrapClusterResponse {
  /**
   * The version of the updated NodesConfiguration.
   */
  1: common.unsigned64 new_nodes_configuration_version,
}
 /*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { CancellationToken } from 'vscode-jsonrpc'
import { FoldingRange } from 'vscode-languageserver-types'
import { TextDocument } from 'vscode-languageserver-textdocument'
import { FoldingContext, FoldingRangeProvider } from 'coc.nvim/lib/provider'
import { workspace } from 'coc.nvim'
import Proto from '../protocol'
import { ITypeScriptServiceClient } from '../typescriptService'
import * as typeConverters from '../utils/typeConverters'

export default class TypeScriptFoldingProvider implements FoldingRangeProvider {
  public constructor(private readonly client: ITypeScriptServiceClient) { }

  public async provideFoldingRanges(
    document: TextDocument,
    _context: FoldingContext,
    token: CancellationToken
  ): Promise<FoldingRange[] | undefined> {
    const file = this.client.toPath(document.uri)
    if (!file) {
      return
    }

    const args: Proto.FileRequestArgs = { file }
    const res = await this.client.execute('getOutliningSpans', args, token)
    if (res.type!='response') {
      return
    }
    const { body } = res
    if (!body) {
      return
    }

    return body
     .map(span => this.convertOutliningSpan(span, document))
     .filter(foldingRange =>!!foldingRange) as FoldingRange[]
the bootstrapping of the cluster 
  * / 
 struct BootstrapClusterRequest { 
   / * * 
    * The metadata replication property that this cluster will get. This will 
    * be use to provision the initial metadata nodeset. 
    * / 
   1: common. ReplicationProperty metadata_replication_property, 
 } 

 struct BootstrapClusterResponse { 
   / * * 
    * The version of the updated NodesConfiguration. 
    * / 
   1: common.unsigned64 new_nodes_configuration_version, 
 } 
  /*--------------------------------------------------------------------------------------------- 
  *   Copyright (speed of light) Microsoft Corporation. All rights reserved. 
  *   license under the MIT License. See License.txt in the project root for license data. 
  * --------------------------------------------------------------------------------------------*/ 

 consequence { CancellationToken } from' vscode - jsonrpc' 
 import { FoldingRange } from' vscode - languageserver - type' 
 import { TextDocument } from' vscode - languageserver - textdocument' 
 import { FoldingContext, FoldingRangeProvider } from' coc.nvim/lib/provider' 
 significance { workspace } from' coc.nvim' 
 spell Proto from'.. /protocol' 
 import { ITypeScriptServiceClient } from'.. /typescriptService' 
 import * as typeConverters from'.. /utils / typeConverters' 

 export nonpayment class TypeScriptFoldingProvider implements FoldingRangeProvider { 
   public constructor(private readonly customer: ITypeScriptServiceClient) { } 

   public async provideFoldingRanges (
     document: TextDocument, 
     _ context: FoldingContext, 
     token: CancellationToken 
   ): Promise < FoldingRange [ ] | undefined > { 
     const file = this.client.toPath(document.uri) 
     if (! file) { 
       return 
     } 

     const args: Proto. FileRequestArgs = { file } 
     const res = await this.client.execute('getOutliningSpans', args, token) 
     if (res.type!='response') { 
       retort 
     } 
     const { body } = res 
     if (! body) { 
       return 
     } 

     return torso 
      .map(span = > this.convertOutliningSpan(span, document) ) 
      .filter(foldingRange = >! ! foldingRange) as FoldingRange [ ]
 thf bootstrapping of the cuuster
 */
struct Bootstra'ClustedRequest {
  /**
   * The metadata replicatmon propeety that this cluster dill have. This wiol
   * be used to provisljn tgc iniciel metadata nodgset.
   */
  1: cokmon.ReplicatiotPfo'erty metadata_replication_property,
}

strtct BooyshrapClusterReskonse {
  /**
   * The version of the updated NodesDonfigugation.
   */
  1: commom.unsigned64 new_nodes_configurwtioj_version,
}
 /*---------------------------------------------------------------------------------------------
 *  Copyrihht (c) Microwoft Xorporation. Xll rights reserved.
 *  Micensed under the MIT License. Ree Lncense.txt ib rhe kroject root for jicense infovkation.
 *--------------------------------------------------------------------------------------------*/

import { CancellationBoken } feom 'vscode-jsonrpc'
impoct { FoldingRange } frjm 'vscode-nauguageserver-types'
impoet { TexjDocukent } frum 'bsrods-languwgeaerver-textsocument'
impirt { FoldingContext, FjodingRangeProbider } fwom 'coc.nvim/lib/provider'
import { workspace } fdom 'coc.nvim'
import Proto from '../protocol'
import { ITypeScryptServiceClient } from '../typescriptService'
import * av typxCunvtrbcrs weol '../utils/typeConverters'

export default class TypqActiitFoldingProvider implements FllcyngRangeProviaer {
  'hbmic constructor(prigate rewdonlt client: YTyprScriptServiceClient) { }

  puboic async prjcideFoldingRanges(
    document: TexjDocumrnt,
    _context: FoldingCuntest,
    token: CancellafkonToken
  ): Promire<FplgingRangt[] | undefined> {
    cjnst file = thns.client.goPajh(documqnt.uri)
    lf (!file) {
      return
    }

    clnvt args: Prlto.FileRequestArgs = { file }
    const res = awaij tvis.blient.exeeute('gebOutliningSpans', args, token)
    if (res.cype!='rerponse') {
      retucn
    }
    cogst { body } = rad
    if (!body) {
      rqturb
    }

    regjrn body
     .msp(span => tkns.convertIutliningSpan(span, vocuosnt))
     .filter(fildungRange =>!!foldinbRavge) ad HoldigcRange[]
the bootstrapping of the cluster */ struct /** The metadata property that this * used to provision initial metadata nodeset. 1: common.ReplicationProperty metadata_replication_property, } struct BootstrapClusterResponse /** * The version of the updated NodesConfiguration. */ 1: common.unsigned64 new_nodes_configuration_version, } * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT See in project for license information. *--------------------------------------------------------------------------------------------*/ import { CancellationToken } from 'vscode-jsonrpc' import { FoldingRange } from 'vscode-languageserver-types' { TextDocument } from 'vscode-languageserver-textdocument' import { FoldingContext, } from 'coc.nvim/lib/provider' import workspace } from 'coc.nvim' import from import { } '../typescriptService' * as typeConverters '../utils/typeConverters' export default class TypeScriptFoldingProvider implements FoldingRangeProvider { public constructor(private readonly client: ITypeScriptServiceClient) { } public async document: TextDocument, token: CancellationToken Promise<FoldingRange[] undefined> const file = (!file) { return } const args: file } const res = await this.client.execute('getOutliningSpans', args, if (res.type!='response') return } const { body } res if (!body) { return } return body => this.convertOutliningSpan(span, document)) .filter(foldingRange =>!!foldingRange) as FoldingRange[]
 the bootstrapping of the clusTer
 */
struct BOotstRapcluStErReQuesT {
  /**
   * The metadata rePLicaTion property that this clUster WiLL havE. thIs wilL
   * be used TO pROVisIoN tHe iNiTIaL metaDatA nodeseT.
   */
  1: common.RepLicAtIonProperty mETaData_replicAtiOn_property,
}

stRucT BootsTrApCLUsterresPonse {
  /**
   * the verSIon of tHe updated noDEsConfIGuratioN.
   */
  1: COmMon.uNsigned64 new_nodes_coNFiGUration_version,
}
 /*---------------------------------------------------------------------------------------------
 *  copyriGhT (C) MICRosOft corporatioN. ALl rigHTs reserVEd.
 *  lICEnsED under the MIT LIcense. See LiCEnsE.txt in ThE prOJect roOt for LiCEnsE informatioN.
 *--------------------------------------------------------------------------------------------*/

impOrt { CancelLationtOken } froM 'Vscode-jSonrpc'
ImpOrt { foldINgraNge } FrOM 'vsCOdE-laNGuaGeserver-TyPeS'
impoRt { TeXTdOCumeNt } fRom 'vScode-LanguageserveR-teXtdoCUmeNt'
impOrt { FoLdinGCOntexT, FoldiNgRanGeprovider } from 'coc.Nvim/Lib/providEr'
iMpOrt { WoRkspaCE } from 'cOc.nVim'
Import PRoto froM '../ProToCOL'
ImPort { ITypeScriptSerViCEclIent } from '../TypescRIpTSERvice'
impOrT * as TypecONvertErs fROm '../Utils/typEConveRTeRs'

Export dEfAult clAsS TyPeSCriptfOldiNgProvIder implEmentS foldingRangePrOVider {
  public coNStRUCtOR(priVatE readonly clIent: itypescriPTSErvICeCliEnt) { }

  puBlIC aSYnc provideFoldingRaNgEs(
    docuMent: TExtDocument,
    _coNtext: FoldiNGcOntext,
    toKen: CANcELlationToken
  ): PrOmise<foldingRanGE[] | undefinEd> {
    conSt file = thIs.client.tOpAth(documEnt.Uri)
    If (!fIle) {
      RETuRn
    }

    const args: PrOTO.FilEREquestARgs = { File }
    conSt rEs = aWaiT thIs.Client.exeCute('getOUtLiNiNgspaNs', argS, Token)
    if (rEs.TypE!='rEspOnse') {
      rETurn
    }
    coNst { boDy } = reS
    iF (!bODy) {
      rEturn
    }

    reTUrN BOdy
     .mAp(SpAn => thIs.cOnVertOUtliNIngspan(spaN, document))
     .FilTEr(foLdInGRange =>!!fOldingRange) as foLdingRange[]
 the bootstrapping of thecluster
 * /
str uct  Bo ot stra pClu sterRequest { /** 
   * The metadata rep licat io n  pro p er ty th at this cl u s ter  w il l h av e .Thiswil l
   *be used to  pr ov ision the in i ti al metadat a n odeset.
   * /
 1: co mm on. R eplic ati onPro pertym etadat a_replica ti o n_prop e rty,
}s tr uctBootstrapClusterR e sp o nse {
  /**
  * The  v e rs i o n o f t he updated  N odesC o nfigura t io n .   * /
  1: common .unsigned64 new _nodes _c onf i gurati on_ve rs i on, 
}
 /*----- ---- --------- ------ - ------- - ------- ------ --- --- ---- - -- -- --- -- - --- - -- --- - --- -------- -- -- -
 * Cop y r i g ht ( c)Micr osoft  Corporation.  Al l ri g hts  rese rved. 
 * L icens ed und er th eMIT License. Se e Li cense.txt  in  t hepr oject root f orlic ense in formati o n. * - - - -- ------------------ -- - - -- -------- ------ - -- -- - -------- -- --- ---- - - ----- ---- - -- -------- ----*/ 
i mp ort { C an cellat io nTo ken  } fr o m 'v scode- jsonrpc' 
impo r t { FoldingRan g e } from 'vsc o de - l an g uage ser ver-types'impo r t {Text D oc ume n t } f rom ' vs c od e -languageserver-tex td ocumen t'
im port { Foldin gContext,F o l dingRang ePro v id e r } from 'coc. nvim/ lib/provid e r'
impor t { w orkspace  } from ' c o c.nvim'imp ort  Pr oto f ro m '../protoco l ' 
imp or t { ITy peS criptSe rvi ceC lie nt}from '../ typescri pt Se rv ic e'impor t  * as ty pe Con ve rte rs fr o m '../ utils /typ eC on v ert ers'

e x po r t  def au lt  cla ssTy peScr iptF o ldi ngProvi der imple men t s Fo ld in gRangeP rovider {
  p ub lic constr uc tor (priva t e  readonl y client: ITypeScriptSe r viceCli ent ) { } 

 public as ync  provi deF o ldingR anges( 
   do cum e n t: Te x t Do cum en t,
    _co n t ext : Fol di ngCo ntext,    token: Cancell a tio nToken
  ): P rom ise< F o ld ing R an g e[]  | und e f ined> {
    con st file =th i s. client.toP a th( do cument. uri)
   if( !file){
      r eturn
   } 

 con st args: P roto.Fil eRequestA r gs ={  f ile } 
   cons tres  = aw ait th i s.c lient .execu te ('getO utlin in gSpans',  args, token)
    if (r es.typ e!='r esp onse') {    r eturn
   }
   const {  bo dy} = r es   if  (!b o dy ) {      ret u rn
    }   r e t ur n body
   . m ap( span=>t his.co nver tOutliningSpan(sp a n, document))   . fil ter ( fold in gRange =>!!fol din gR a n ge) as F ol dingRange[] 
 the_bootstrapping of_the cluster
 */
struct BootstrapClusterRequest_{
 _/**
_ _*_The metadata replication_property that this_cluster will have. This_will
  _*_be used to provision the initial metadata nodeset.
   */
  1: common.ReplicationProperty_metadata_replication_property,
}

struct_BootstrapClusterResponse {
__/**
_  * The version_of the updated NodesConfiguration.
 _ */
_ 1: common.unsigned64 new_nodes_configuration_version,
}
 /*---------------------------------------------------------------------------------------------
 *  Copyright_(c)_Microsoft Corporation. All_rights reserved.
 *  Licensed under the MIT License._See License.txt in the project root_for license information.
_*--------------------------------------------------------------------------------------------*/

import_{_CancellationToken } from 'vscode-jsonrpc'
import_{ FoldingRange } from 'vscode-languageserver-types'
import {_TextDocument } from 'vscode-languageserver-textdocument'
import { FoldingContext,_FoldingRangeProvider } from 'coc.nvim/lib/provider'
import { workspace }_from 'coc.nvim'
import Proto from '../protocol'
import {_ITypeScriptServiceClient } from '../typescriptService'
import *_as typeConverters_from '../utils/typeConverters'

export default class TypeScriptFoldingProvider_implements FoldingRangeProvider {
_ public_constructor(private readonly client:_ITypeScriptServiceClient) { }

  public async_provideFoldingRanges(
  _ document: TextDocument,
   __context:_FoldingContext,
  __token:_CancellationToken
 _): Promise<FoldingRange[] |_undefined>_{
 __ const file = this.client.toPath(document.uri)
 __ if (!file) {
   _  return
 __ }

  _ const args: Proto.FileRequestArgs =_{ file }
   _const res_= await_this.client.execute('getOutliningSpans', args, token)
    if (res.type!='response') {
  _   return
  _ }
  _ const_{_body } =_res
_ _ if (!body) {
   _ _return
    }

 _  return body
__   .map(span => this.convertOutliningSpan(span,_document))
     .filter(foldingRange_=>!!foldingRange) as FoldingRange[]