@@ -258,7 +258,7 @@ export type TypeScriptInfo = {
258258 typeScript : typeof ts ;
259259 libLocation : string ;
260260} ;
261- export function createProject ( baseDirectory : string , config : TypeScriptProjectConfig , fileSystem : fs . IFileSystem , workingSet : ws . IWorkingSet , defaultLibLocation : string ) : TypeScriptProject ;
261+ export function createProject ( documentRegistry : ts . DocumentRegistry , baseDirectory : string , config : TypeScriptProjectConfig , fileSystem : fs . IFileSystem , workingSet : ws . IWorkingSet , defaultLibLocation : string ) : TypeScriptProject ;
262262
263263
264264}
@@ -590,10 +590,6 @@ import fs = require('typescript-project-services/lib/fileSystem');
590590import ws = require( 'typescript-project-services/lib/workingSet' ) ;
591591import project = require( 'typescript-project-services/lib/project' ) ;
592592import console = require( 'typescript-project-services/lib/logger' ) ;
593- export type Position = {
594- line : number ;
595- ch : number ;
596- } ;
597593export import Logger = console . Logger ;
598594export var injectLogger : typeof console . injectLogger ;
599595export var injectPromiseLibrary : typeof promise . injectPromiseLibrary ;
@@ -630,81 +626,28 @@ export function updateProjectConfigs(configs: {
630626 * dispose the service
631627 */
632628export function dispose ( ) : void ;
633- /**
634- * Represent definition info of a symbol
635- */
636- export type DefinitionInfo = {
637- /**
638- * full name of the symbol
639- */
640- name : string ;
641- /**
642- * line at which the symbol definition start
643- */
644- lineStart : number ;
645- /**
646- * charachter at which the symbol definition start
647- */
648- charStart : number ;
649- /**
650- * line at which the symbol definition end
651- */
652- lineEnd : number ;
653- /**
654- * charachter at which the symbol definition end
655- */
656- charEnd : number ;
657- /**
658- * path of the file where the symbol is defined
659- */
660- fileName : string ;
629+ export type TextSpan = {
630+ start : number ;
631+ length : number ;
661632} ;
662- /**
663- * Retrieve definition info of a symbol at a given position in a given file.
664- * return a promise resolving to a list of definition info.
665- *
666- * @param fileName the absolute path of the file
667- * @param position in the file where you want to retrieve definition info
668- *
669- */
670- export function getDefinitionAtPosition ( fileName : string , position : Position ) : promise . Promise < DefinitionInfo [ ] > ;
671- export const enum DiagnosticCategory {
672- Warning = 0 ,
673- Error = 1 ,
674- Message = 2 ,
675- }
676- export type TSError = {
677- pos : Position ;
678- endPos : Position ;
679- message : string ;
680- type : DiagnosticCategory ;
633+ export type Diagnostics = {
634+ fileName : string ;
635+ start : number ;
636+ length : number ;
637+ messageText : string ;
638+ category : ts . DiagnosticCategory ;
639+ code : number ;
681640} ;
682641/**
683642 * Retrieve a list of errors for a given file
684643 * return a promise resolving to a list of errors
685644 *
686645 * @param fileName the absolute path of the file
646+ * @param allErrors by default errors are checked in 3 phases, options check, syntax check,
647+ * semantic check, is allErrors is set to false, the service won't check the nex phase
648+ * if there is error in the precedent one
687649 */
688- export function getErrorsForFile ( fileName : string ) : promise . Promise < TSError [ ] > ;
689- export type TextEdit = {
690- start : number ;
691- end : number ;
692- newText : string ;
693- } ;
694- /**
695- * Retrieve formating information for a givent file.
696- * return a promise resolving to a list of TextEdit
697- *
698- * @param fileName the absolute path of the file
699- * @param options formation options
700- * @param startPos an option start position for the formating range
701- * @param endPos an optional end position for the formating range
702- *
703- */
704- export function getFormatingForFile ( fileName : string , options : ts . FormatCodeOptions , startPos ?: Position , endPos ?: Position ) : promise . Promise < TextEdit [ ] > ;
705- /**
706- * Represent a completion result
707- */
650+ export function getDiagnosticsForFile ( fileName : string , allErrors ?: boolean ) : promise . Promise < Diagnostics [ ] > ;
708651export type CompletionResult = {
709652 /**
710653 * the matched string portion
@@ -725,27 +668,84 @@ export type CompletionResult = {
725668 * @param skip the number of proposition this service should skip
726669 *
727670 */
728- export function getCompletionAtPosition ( fileName : string , position : Position , limit ?: number , skip ?: number ) : promise . Promise < CompletionResult > ;
671+ export function getCompletionAtPosition ( fileName : string , position : number , limit ?: number , skip ?: number ) : promise . Promise < CompletionResult > ;
672+ export type QuickInfo = {
673+ kind : string ;
674+ kindModifiers : string ;
675+ textSpan : TextSpan ;
676+ displayParts : ts . SymbolDisplayPart [ ] ;
677+ documentation : ts . SymbolDisplayPart [ ] ;
678+ } ;
679+ export function getQuickInfoAtPosition ( fileName : string , position : number ) : promise . Promise < QuickInfo > ;
680+ export type SignatureHelpItems = {
681+ items : ts . SignatureHelpItem [ ] ;
682+ applicableSpan : TextSpan ;
683+ selectedItemIndex : number ;
684+ argumentIndex : number ;
685+ argumentCount : number ;
686+ } ;
687+ export function getSignatureHelpItems ( fileName : string , position : number ) : promise . Promise < SignatureHelpItems > ;
688+ export type RenameInfo = {
689+ canRename : boolean ;
690+ localizedErrorMessage : string ;
691+ displayName : string ;
692+ fullDisplayName : string ;
693+ kind : string ;
694+ kindModifiers : string ;
695+ triggerSpan : TextSpan ;
696+ } ;
697+ export function getRenameInfo ( fileName : string , position : number ) : promise . Promise < RenameInfo > ;
698+ export function findRenameLocations ( fileName : string , position : number , findInStrings : boolean , findInComments : boolean ) : promise . Promise < {
699+ textSpan : TextSpan ;
700+ fileName : string ;
701+ } [ ] > ;
702+ export type DefinitionInfo = {
703+ fileName : string ;
704+ textSpan : TextSpan ;
705+ kind : string ;
706+ name : string ;
707+ containerKind : string ;
708+ containerName : string ;
709+ } ;
710+ export function getDefinitionAtPosition ( fileName : string , position : number ) : promise . Promise < DefinitionInfo [ ] > ;
711+ export type ReferenceEntry = {
712+ textSpan : TextSpan ;
713+ fileName : string ;
714+ isWriteAccess : boolean ;
715+ } ;
716+ export function getReferencesAtPosition ( fileName : string , position : number ) : promise . Promise < ReferenceEntry [ ] > ;
717+ export function getOccurrencesAtPosition ( fileName : string , position : number ) : promise . Promise < ReferenceEntry [ ] > ;
718+ export type NavigateToItem = {
719+ name : string ;
720+ kind : string ;
721+ kindModifiers : string ;
722+ matchKind : string ;
723+ fileName : string ;
724+ textSpan : TextSpan ;
725+ containerName : string ;
726+ containerKind : string ;
727+ } ;
728+ export function getNavigateToItems ( fileName : string , search : string ) : promise . Promise < NavigateToItem [ ] > ;
729729export type NavigationBarItem = {
730730 text : string ;
731731 kind : string ;
732732 kindModifiers : string ;
733- positions : {
733+ spans : {
734734 start : number ;
735- end : number ;
735+ length : number ;
736736 } [ ] ;
737737 childItems : NavigationBarItem [ ] ;
738738 indent : number ;
739739 bolded : boolean ;
740740 grayed : boolean ;
741741} ;
742- /**
743- * Retrieve NavigationBarItems
744- *
745- * @param fileName the absolute path of the file
746- *
747- */
748742export function getNavigationBarItems ( fileName : string ) : promise . Promise < NavigationBarItem [ ] > ;
743+ export type TextChange = {
744+ span : TextSpan ;
745+ newText : string ;
746+ } ;
747+ export function getFormattingEditsForFile ( fileName : string , options : ts . FormatCodeOptions , start : number , end : number ) : promise . Promise < TextChange [ ] > ;
748+ export function getEmitOutput ( fileName : string ) : promise . Promise < ts . EmitOutput > ;
749749
750750
751751}
0 commit comments