當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript uri.toString函數代碼示例

本文整理匯總了TypeScript中@theia/core/lib/common/uri.toString函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript toString函數的具體用法?TypeScript toString怎麽用?TypeScript toString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了toString函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: directoryFor

 protected async directoryFor(uri: URI): Promise<FileStat | undefined> {
     const stat = await this.fileSystem.getFileStat(uri.toString());
     if (stat && stat.isDirectory) {
         return stat;
     }
     return this.parentOf(uri);
 }
開發者ID:crapo,項目名稱:sadlos2,代碼行數:7,代碼來源:sadl-command-contribution.ts

示例2: URI

 execute: async uri => {
     if (await this.inSadlProject(uri)) {
         this.messageService.warn('Nested SADL projects are not supported.');
     } else {
         const parent = await this.directoryFor(uri);
         if (parent) {
             const parentUri = new URI(parent.uri);
             const vacantChildUri = this.findVacantChildUri(parentUri, parent, 'Untitled');
             const dialog = new SingleTextInputDialog({
                 title: 'New SADL Project',
                 initialValue: vacantChildUri.path.base,
                 validate: name => this.validateFileName(name, parent)
             });
             try {
                 const name = await dialog.open();
                 if (name) {
                     const desiredUri = parentUri.resolve(name);
                     await this.fileSystem.createFolder(desiredUri.toString())
                     const content = this.dotProjectContent(desiredUri.path.base);
                     await this.fileSystem.createFile(desiredUri.resolve('.project').toString(), { content });
                     await this.fileSystem.createFile(desiredUri.resolve('settings.json').toString(), { content: DefaultSadlConfigSchema.content() });
                     const widget = await this.navigatorContribution.widget;
                     const fileTreeModel = widget.model;
                     const parent = fileTreeModel.getNode(parentUri.toString());
                     const toDisposeAfterExpand = fileTreeModel.onChanged(async () => {
                         const node = fileTreeModel.getNode(desiredUri.toString());
                         if (node) {
                             if (SelectableTreeNode.is(node) && !SelectableTreeNode.isSelected(node)) {
                                 fileTreeModel.selectNode(node);
                             }
                             if (ExpandableTreeNode.is(node) && ExpandableTreeNode.isCollapsed(node)) {
                                 await fileTreeModel.expandNode(node);
                             }
                             toDisposeAfterExpand.dispose();
                         }
                     });
                     if (ExpandableTreeNode.is(parent) && ExpandableTreeNode.isCollapsed(parent)) {
                         await fileTreeModel.expandNode(parent);
                     }
                 }
             } catch {
                 // Dialog cancel.
             }
         }
     }
 },
開發者ID:crapo,項目名稱:sadlos2,代碼行數:46,代碼來源:sadl-command-contribution.ts

示例3: isSadl

 protected async isSadl(uri: URI | undefined): Promise<boolean> {
     return !!uri && this.inSadlProject(uri) && uri.toString().endsWith('.sadl');
 }
開發者ID:crapo,項目名稱:sadlos2,代碼行數:3,代碼來源:sadl-command-contribution.ts

示例4: isExternalDefinition

 protected async isExternalDefinition(uri: URI | undefined): Promise<boolean> {
     return !!uri && this.inSadlProject(uri) && uri.toString().endsWith('.url');
 }
開發者ID:crapo,項目名稱:sadlos2,代碼行數:3,代碼來源:sadl-command-contribution.ts

示例5: inSadlProject

 protected async inSadlProject(uri: URI | undefined): Promise<boolean> {
     if (uri) {
         const languageClient = await this.languageClientContribution.languageClient;
         const result = await languageClient.sendRequest(SadlProjectRoot.TYPE, { uri: uri.toString() });
         return !!result.uri;
     }
     return false;
 }
開發者ID:crapo,項目名稱:sadlos2,代碼行數:8,代碼來源:sadl-command-contribution.ts


注:本文中的@theia/core/lib/common/uri.toString函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。