Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/import{ addDisposableListener, getWindow, isHTMLElement, reset }from'../../../../base/browser/dom.js';import{ StandardKeyboardEvent }from'../../../../base/browser/keyboardEvent.js';import{ getDefaultHoverDelegate }from'../../../../base/browser/ui/hover/hoverDelegateFactory.js';import{ KeyCode }from'../../../../base/common/keyCodes.js';import{ DisposableStore }from'../../../../base/common/lifecycle.js';import{ Schemas }from'../../../../base/common/network.js';import*as osPath from'../../../../base/common/path.js'
platform
localize
IConfigurationService
IFileService
IHoverService
IOpenerService
ITunnelService
IWorkspaceFolder
IDebugSession
IEditorService
IWorkbenchEnvironmentService
IPathService
IHighlight
Iterable
kind LinkKind
value
captures
index
DebugLinkHoverBehavior
Rich
hoverBehaviorfoojs$lineCol`
link uri fulltext hoverBehavior
urischeme Schemasfile
fsPath urifsPath
path pathServicepath
fileUrl osPathpathsep osPathposixsep platformisWindows fsPath osPathposixsep fsPath
fileUri fileUrl
exists fileServicefileUri
exists
editorService
resource fileUri
options
pinned
selection lineCol startLineNumber lineCol startColumn lineCol lineCol
openerServiceurl allowTunneling environmentServiceremoteAuthority configurationService
link
fulltext text path lineNumber columnNumber workspaceFolder IWorkspaceFolder hoverBehavior DebugLinkHoverBehaviorTypeData Node
path path
documenttext
options lineNumber
selection startLineNumber lineNumber startColumn columnNumber columnNumber
path
workspaceFolder
documenttext
uri workspaceFolderpath
link text
link uri fulltext hoverBehavior preserveFocus editorService resource uri options options preserveFocus
link
path
userHome pathServiceresolvedUserHome
userHome
path osPathuserHomefsPath path
link text
linktabIndex
uri osPathpath
fileServiceuristat
statisDirectory
link uri fulltext hoverBehavior preserveFocus editorService resource uri options options preserveFocus
link
text HTMLElement
link document
linktextContent text
link
link HTMLElement uri fulltext hoverBehavior DebugLinkHoverBehaviorTypeData preserveFocus
hoverBehaviorstoreisDisposed
linkclassList
followLink uri tunnelServiceuri
title linkariaLabel fulltext
platformisMacintosh followLink fulltext followLink fulltext
platformisMacintosh followLink followLink
hoverBehaviortype DebugLinkHoverBehaviorRich
hoverBehaviorstorehoverService link title
hoverBehaviortype DebugLinkHoverBehaviorNone
linktitle title
hoverBehaviorstorelink event MouseEvent
linkclassList platformisMacintosh eventmetaKey eventctrlKey
hoverBehaviorstorelink
linkclassList
hoverBehaviorstorelink event MouseEvent
selection link
selection selectiontype
platformisMacintosh eventmetaKey eventctrlKey
event
event
hoverBehaviorstorelink e KeyboardEvent
event e
eventkeyCode KeyCodeEnter eventkeyCode KeyCodeSpace
event
event
eventkeyCode KeyCodeSpace
text LinkPart
textlength
kind value text captures index
regexes RegExp
kinds LinkKind
result LinkPart
text regexIndex baseIndex
regexIndex regexeslength
result value text kind captures index baseIndex
regex regexesregexIndex
currentIndex
match
regexlastIndex
match regextext
stringBeforeMatch textcurrentIndex matchindex
stringBeforeMatch
stringBeforeMatch regexIndex baseIndex currentIndex
value match
result
value value
kind kindsregexIndex
captures match
index baseIndex matchindex
currentIndex matchindex valuelength
stringAfterMatches textcurrentIndex
stringAfterMatches
stringAfterMatches regexIndex baseIndex currentIndex
text
result
` by propagating disposables appropriately
*/
Basic,
/** No hover */
None
}
/** Store implies HoverBehavior=rich */
export type DebugLinkHoverBehaviorTypeData =
| { type: DebugLinkHoverBehavior.None; store: DisposableStore }
| { type: DebugLinkHoverBehavior.Basic; store: DisposableStore }
| { type: DebugLinkHoverBehavior.Rich; store: DisposableStore };
export interface ILinkDetector {
linkify(text: string, hoverBehavior: DebugLinkHoverBehaviorTypeData, splitLines?: boolean, workspaceFolder?: IWorkspaceFolder, includeFulltext?: boolean, highlights?: IHighlight[]): HTMLElement;
linkifyLocation(text: string, locationReference: number, session: IDebugSession, hoverBehavior: DebugLinkHoverBehaviorTypeData): HTMLElement;
}
export class LinkDetector implements ILinkDetector {
constructor(
@IEditorService private readonly editorService: IEditorService,
@IFileService private readonly fileService: IFileService,
@IOpenerService private readonly openerService: IOpenerService,
@IPathService private readonly pathService: IPathService,
@ITunnelService private readonly tunnelService: ITunnelService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IHoverService private readonly hoverService: IHoverService,
) {
// noop
}
/**
* Matches and handles web urls, absolute and relative file links in the string provided.
* Returns <span/> element that wraps the processed string, where matched links are replaced by <a/>.
* 'onclick' event is attached to all anchored links that opens them in the editor.
* When splitLines is true, each line of the text, even if it contains no links, is wrapped in a <span>
* and added as a child of the returned <span>.
* The `
` is required and manages the lifecycle of event listeners.
*/
linkify(text: string, hoverBehavior: DebugLinkHoverBehaviorTypeData, splitLines?: boolean, workspaceFolder?: IWorkspaceFolder, includeFulltext?: boolean, highlights?: IHighlight[]): HTMLElement {
return this._linkify(text, hoverBehavior, splitLines, workspaceFolder, includeFulltext, highlights);
}
private _linkify(text: string, hoverBehavior: DebugLinkHoverBehaviorTypeData, splitLines?: boolean, workspaceFolder?: IWorkspaceFolder, includeFulltext?: boolean, highlights?: IHighlight[], defaultRef?: { locationReference: number; session: IDebugSession }): HTMLElement {
if (splitLines) {
const lines = text.split('\n');
for (let i = 0; i < lines.length - 1; i++) {
lines[i] = lines[i] + '\n';
}
if (!lines[lines.length - 1]) {
// Remove the last element ('') that split added.
lines.pop();
}
const elements = lines.map(line => this._linkify(line, hoverBehavior, false, workspaceFolder, includeFulltext, highlights, defaultRef));
if (elements.length === 1) {
// Do not wrap single line with extra span.
return elements[0];
}
const container = document.createElement('span');
elements.forEach(e => container.appendChild(e));
return container;
}
const container = document.createElement('span');
for (const part of this.detectLinks(text)) {
try {
let node: Node;
switch (part.kind) {
case 'text':
node = defaultRef ? this.linkifyLocation(part.value, defaultRef.locationReference, defaultRef.session, hoverBehavior) : document.createTextNode(part.value);
break;
case 'web':
node = this.createWebLink(includeFulltext ? text : undefined, part.value, hoverBehavior);
break;
case 'path': {
const path = part.captures[0];
const lineNumber = part.captures[1] ? Number(part.captures[1]) : 0;
const columnNumber = part.captures[2] ? Number(part.captures[2]) : 0;
node = this.createPathLink(includeFulltext ? text : undefined, part.value, path, lineNumber, columnNumber, workspaceFolder, hoverBehavior);
break;
}
default:
node = document.createTextNode(part.value);
}
container.append(...this.applyHighlights(node, part.index, part.value.length, highlights));
} catch (e) {
container.appendChild(document.createTextNode(part.value));
}
}
return container;
}
private applyHighlights(node: Node, startIndex: number, length: number, highlights: IHighlight[] | undefined): Iterable<Node | string> {
const children: (Node | string)[] = [];
let currentIndex = startIndex;
const endIndex = startIndex + length;
for (const highlight of highlights || []) {
if (highlight.end <= currentIndex || highlight.start >= endIndex) {
continue;
}
if (highlight.start > currentIndex) {
children.push(node.textContent!.substring(currentIndex - startIndex, highlight.start - startIndex));
currentIndex = highlight.start;
}
const highlightEnd = Math.min(highlight.end, endIndex);
const highlightedText = node.textContent!.substring(currentIndex - startIndex, highlightEnd - startIndex);
const highlightSpan = document.createElement('span');
highlightSpan.classList.add('highlight');
if (highlight.extraClasses) {
highlightSpan.classList.add(...highlight.extraClasses);
}
highlightSpan.textContent = highlightedText;
children.push(highlightSpan);
currentIndex = highlightEnd;
}
if (currentIndex === startIndex) {
return Iterable.single(node); // no changes made
}
if (currentIndex < endIndex) {
children.push(node.textContent!.substring(currentIndex - startIndex));
}
// reuse the element if it's a link
if (isHTMLElement(node)) {
reset(node, ...children);
return Iterable.single(node);
}
return children;
}
/**
* Linkifies a location reference.
*/
linkifyLocation(text: string, locationReference: number, session: IDebugSession, hoverBehavior: DebugLinkHoverBehaviorTypeData) {
const link = this.createLink(text);
this.decorateLink(link, undefined, text, hoverBehavior, async (preserveFocus: boolean) => {
const location = await session.resolveLocationReference(locationReference);
await location.source.openInEditor(this.editorService, {
startLineNumber: location.line,
startColumn: location.column,
endLineNumber: location.endLine ?? location.line,
endColumn: location.endColumn ?? location.column,
}, preserveFocus);
});
return link;
}
/**
* Makes an {@link ILinkDetector} that links everything in the output to the
* reference if they don't have other explicit links.
*/
makeReferencedLinkDetector(locationReference: number, session: IDebugSession): ILinkDetector {
return {
linkify: (text, hoverBehavior, splitLines, workspaceFolder, includeFulltext, highlights) =>
this._linkify(text, hoverBehavior, splitLines, workspaceFolder, includeFulltext, highlights, { locationReference, session }),
linkifyLocation: this.linkifyLocation.bind(this),
};
}
private createWebLink(fulltext: string | undefined, url: string, hoverBehavior: DebugLinkHoverBehaviorTypeData): Node {
const link = this.createLink(url);
let uri = URI.parse(url);
// if the URI ends with something like `
.
:
12
:
3
`, parse
// that into a fragment to reveal that location (#150702)
const lineCol = LINE_COLUMN_REGEX.exec(uri.path);
if (lineCol) {
uri = uri.with({
path: uri.path.slice(0, lineCol.index),
fragment: `
L
{
[
0
]
.
slice
(
1
)
}
}
)
;
}
this
.
decorateLink
(
,
,
,
,
async
(
)
=>
{
if
(
.
===
.
)
{
// Just using fsPath here is unsafe: https://github.com/microsoft/vscode/issues/109076
const
=
.
;
const
=
await
this
.
.
;
const
=
.
normalize
(
(
(
.
===
.
.
)
&&
.
)
?
.
replace
(
/\\/g
,
.
.
)
:
)
;
const
=
URI
.
parse
(
)
;
const
=
await
this
.
.
exists
(
)
;
if
(
!
)
{
return
;
}
await
this
.
.
openEditor
(
{
:
,
:
{
:
true
,
:
?
{
:
+
[
1
]
,
:
[
2
]
?
+
[
2
]
:
1
}
:
undefined
,
}
,
}
)
;
return
;
}
this
.
.
open
(
,
{
:
(
!
!
this
.
.
&&
this
.
.
getValue
(
'remote.forwardOnOpen'
)
)
}
)
;
}
)
;
return
;
}
private
createPathLink
(
:
string
|
undefined
,
:
string
,
:
string
,
:
number
,
:
number
,
:
|
undefined
,
:
)
:
{
if
(
[
0
]
===
'/'
&&
[
1
]
===
'/'
)
{
// Most likely a url part which did not match, for example ftp://path.
return
.
createTextNode
(
)
;
}
// Only set selection if we have a valid line number (greater than 0)
const
=
>
0
?
{
:
{
:
,
:
>
0
?
:
1
}
}
:
{
}
;
if
(
[
0
]
===
'.'
)
{
if
(
!
)
{
return
.
createTextNode
(
)
;
}
const
=
.
toResource
(
)
;
const
=
this
.
createLink
(
)
;
this
.
decorateLink
(
,
,
,
,
(
:
boolean
)
=>
this
.
.
openEditor
(
{
:
,
:
{
...
,
}
}
)
)
;
return
;
}
if
(
[
0
]
===
'~'
)
{
const
=
this
.
.
;
if
(
)
{
=
.
join
(
.
,
.
substring
(
1
)
)
;
}
}
const
=
this
.
createLink
(
)
;
.
=
0
;
const
=
URI
.
file
(
.
normalize
(
)
)
;
this
.
.
stat
(
)
.
then
(
=>
{
if
(
.
)
{
return
;
}
this
.
decorateLink
(
,
,
,
,
(
:
boolean
)
=>
this
.
.
openEditor
(
{
:
,
:
{
...
,
}
}
)
)
;
}
)
.
catch
(
(
)
=>
{
// If the uri can not be resolved we should not spam the console with error, remain quite #86587