Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85e01ef

Browse files
authored
nicer label for setting references (microsoft#222280)
1 parent6d186d4 commit85e01ef

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import { Emitter, Event } from 'vs/base/common/event';
1111
import{Disposable,DisposableStore,IDisposable}from'vs/base/common/lifecycle';
1212
import{matchesSomeScheme,Schemas}from'vs/base/common/network';
1313
import{basename}from'vs/base/common/path';
14-
import{basenameOrAuthority}from'vs/base/common/resources';
14+
import{basenameOrAuthority,isEqualAuthority}from'vs/base/common/resources';
1515
import{ThemeIcon}from'vs/base/common/themables';
1616
import{URI}from'vs/base/common/uri';
1717
import{localize}from'vs/nls';
1818
import{FileKind}from'vs/platform/files/common/files';
1919
import{IInstantiationService}from'vs/platform/instantiation/common/instantiation';
2020
import{WorkbenchList}from'vs/platform/list/browser/listService';
2121
import{IOpenerService}from'vs/platform/opener/common/opener';
22+
import{IProductService}from'vs/platform/product/common/productService';
2223
import{IThemeService}from'vs/platform/theme/common/themeService';
2324
import{IResourceLabel,ResourceLabels}from'vs/workbench/browser/labels';
2425
import{ColorScheme}from'vs/workbench/browser/web.api';
@@ -29,6 +30,7 @@ import { IChatContentReference, IChatWarningMessage } from 'vs/workbench/contrib
2930
import{IChatVariablesService}from'vs/workbench/contrib/chat/common/chatVariables';
3031
import{IChatRendererContent,IChatResponseViewModel}from'vs/workbench/contrib/chat/common/chatViewModel';
3132
import{createFileIconThemableTreeContainerScope}from'vs/workbench/contrib/files/browser/views/explorerView';
33+
import{SETTINGS_AUTHORITY}from'vs/workbench/services/preferences/common/preferences';
3234

3335
const$=dom.$;
3436

@@ -243,6 +245,7 @@ class CollapsibleListRenderer implements IListRenderer<IChatCollapsibleListItem,
243245
privatelabels:ResourceLabels,
244246
@IThemeServiceprivatereadonlythemeService:IThemeService,
245247
@IChatVariablesServiceprivatereadonlychatVariablesService:IChatVariablesService,
248+
@IProductServiceprivatereadonlyproductService:IProductService,
246249
){}
247250

248251
renderTemplate(container:HTMLElement):ICollapsibleListTemplate{
@@ -287,11 +290,15 @@ class CollapsibleListRenderer implements IListRenderer<IChatCollapsibleListItem,
287290
}
288291
}else{
289292
consturi='uri'inreference ?reference.uri :reference;
290-
if(uri.scheme==='https'&&uri.authority==='github.com'&&uri.path.includes('/tree/')){
293+
if(uri.scheme==='https'&&isEqualAuthority(uri.authority,'github.com')&&uri.path.includes('/tree/')){
291294
// Parse a nicer label for GitHub URIs that point at a particular commit + file
292295
constlabel=uri.path.split('/').slice(1,3).join('/');
293296
constdescription=uri.path.split('/').slice(5).join('/');
294297
templateData.label.setResource({resource:uri,name:label, description},{icon:Codicon.github,title:data.title});
298+
}elseif(uri.scheme===this.productService.urlProtocol&&isEqualAuthority(uri.authority,SETTINGS_AUTHORITY)){
299+
// a nicer label for settings URIs
300+
constsettingId=uri.path.substring(1);
301+
templateData.label.setResource({resource:uri,name:settingId},{icon:Codicon.settingsGear,title:localize('setting.hover',"Open setting '{0}'",settingId)});
295302
}elseif(matchesSomeScheme(uri,Schemas.mailto,Schemas.http,Schemas.https)){
296303
templateData.label.setResource({resource:uri,name:uri.toString()},{icon:icon??Codicon.globe,title:data.title});
297304
}else{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp