ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / prompts / node / inline / languageServerContextPrompt.tsx 145 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import { PromptElement , PromptElementProps , type PromptSizing } from '@vscode/prompt-tsx' ;
import type { CancellationToken , ChatResponsePart , Position , Progress } from 'vscode' ;
import { ConfigKey , IConfigurationService } from '../../../../platform/configuration/common/configurationService' ;
import { TextDocumentSnapshot } from '../../../../platform/editing/common/textDocumentSnapshot' ;
import
position
requestId
source
snippetCounts
totalCharLength
requestId
timeBudget
tokenBudget
props
@ languageContextService
@ configurationService
@ experimentationService
@ ignoreService
props
_state sizing _progress token
configKey
configKey
useLanguageServerContext configKey
useLanguageServerContext
context tokenBudget sizing
context
context
validItems
contextItems context token
outer item contextItems
item
item
item
item item
uri item
uri
outer
validItems item
validItems
validItems item
{
IIgnoreService
}
from
'../../../../platform/ignore/common/ignoreService'
;
import
{
ContextKind
,
ILanguageContextService
,
KnownSources
,
SnippetContext
,
type
RequestContext
}
from
'../../../../platform/languageServer/common/languageContextService'
;
import
{ IExperimentationService }
from
'../../../../platform/telemetry/common/nullExperimentationService'
;
import
{ Iterable }
from
'../../../../util/vs/base/common/iterator'
;
import
{ TelemetryData }
from
'../../../prompt/node/intents'
;
import
{ Tag }
from
'../base/tag'
;
import
{ CodeBlock , Uri as UriElement , UriMode }
from
'../panel/safeElements'
;
export
type
LanguageServerContextProps
=
PromptElementProps
<
{
document
:
TextDocumentSnapshot
;
:
Position
;
?
:
string
;
?
:
KnownSources
|
string
;
}
>
;
export
class
LanguageServerContextStats
extends
TelemetryData
{
constructor
(
readonly
:
number
,
readonly
:
number
,
)
{
super
(
)
;
}
}
export
class
LanguageServerContextPrompt
extends
PromptElement< LanguageServerContextProps>
{
private
static
CompletionContext
:
RequestContext
=
{
:
'0013686c-f799-4ed9-ad07-35369dbd6e26'
,
:
2500
,
:
32_000
,
}
;
constructor
(
:
LanguageServerContextProps
,
ILanguageContextService
private
readonly
:
ILanguageContextService
,
IConfigurationService
private
readonly
:
IConfigurationService
,
IExperimentationService
private
readonly
:
IExperimentationService
,
IIgnoreService
private
readonly
:
IIgnoreService
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
,
:
Progress
<
ChatResponsePart
>
,
:
CancellationToken
)
{
const
=
this
.
props
.
source
===
KnownSources
.
chat
?
ConfigKey
.
TypeScriptLanguageContextInline
:
this
.
props
.
source
===
KnownSources
.
fix
?
ConfigKey
.
TypeScriptLanguageContextFix
:
undefined
;
if
(
===
undefined
)
{
return
;
}
const
=
this
.
configurationService
.
getExperimentBasedConfig
(
,
this
.
experimentationService
)
;
if
(
!
)
{
return
;
}
if
(
!
await
this
.
languageContextService
.
isActivated
(
this
.
props
.
document
.
languageId
)
)
{
return
;
}
const
:
RequestContext
=
Object
.
assign
(
{
}
,
LanguageServerContextPrompt
.
CompletionContext
,
{
:
.
tokenBudget
}
)
;
if
(
this
.
props
.
requestId
!==
undefined
)
{
.
requestId
=
this
.
props
.
requestId
;
}
if
(
this
.
props
.
source
!==
undefined
)
{
.
source
=
this
.
props
.
source
;
}
const
:
SnippetContext
[
]
=
[
]
;
const
=
this
.
languageContextService
.
getContext
(
this
.
props
.
document
.
document
,
this
.
props
.
position
,
,
)
;
:
for
await
(
const
of
)
{
if
(
.
kind
===
ContextKind
.
Snippet
)
{
if
(
.
value
.
length
===
0
)
{
continue
;
}
if
(
await
this
.
ignoreService
.
isCopilotIgnored
(
.
uri
)
)
{
continue
;
}
if
(
.
additionalUris
!==
undefined
&&
.
additionalUris
.
length
>
0
)
{
for
(
const
of
.
additionalUris
)
{
if
(
await
this
.
ignoreService
.
isCopilotIgnored
(
)
)
{
continue
;
}
}
}
.
push
(
)
;
}
}
if
(
.
length
===
0
)
{
return
;
}
return
< Tag name = ' languageServerContext' >
A language server finds these documents helpful for answering the user's question<br />
< Tag name = ' note' >
These documents are provided as extra insights but are not meant to be edited or changed in any way.
</ Tag >
{
.
map
(
=>
{
return
< >
< Tag name = ' documentFragment' >
From `<UriElement value={item.uri} mode={UriMode.Path} />` I have read or edited:
< br />
< CodeBlock uri = { item. uri } code = { item. value } priority = { item. priority * Number . MAX_SAFE_INTEGER } />
</ Tag >
< br />
</ >
;
}
)
}
< meta value = { new LanguageServerContextStats (
validItems. length ,
Iterable . reduce ( validItems. values ( ) , ( t, item) => t + item. value . length , 0 ) )
} />
</ Tag >
;
}
}