Skip to content

Commit 2c0bde7

Browse files
committed
feat: generated types integrated in LSR
1 parent 7d68a30 commit 2c0bde7

File tree

13 files changed

+224
-245
lines changed

13 files changed

+224
-245
lines changed

chat-client-ui-types/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"author": "Amazon Web Services",
1919
"license": "Apache-2.0",
2020
"dependencies": {
21-
"@aws/language-server-runtimes-types": "^0.1.56"
21+
"@aws/language-server-runtimes-types": "^0.1.56",
22+
"@local/language-server-runtimes-generated-types": "file:/Users/conorstw/Desktop/language-server-runtimes/types/codegen/generated"
2223
}
2324
}

chat-client-ui-types/src/uiContracts.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
import { OPEN_TAB_REQUEST_METHOD, GET_SERIALIZED_CHAT_REQUEST_METHOD } from '@aws/language-server-runtimes-types'
12
import {
23
InsertToCursorPositionParams,
34
ChatOptions,
45
CodeSelectionType,
56
ReferenceTrackerInformation,
6-
OPEN_TAB_REQUEST_METHOD,
77
OpenTabResult,
8-
GET_SERIALIZED_CHAT_REQUEST_METHOD,
98
GetSerializedChatResult,
109
ChatPrompt,
1110
OpenFileDialogParams,
1211
DropFilesParams,
13-
} from '@aws/language-server-runtimes-types'
14-
export { InsertToCursorPositionParams } from '@aws/language-server-runtimes-types'
12+
} from '@local/language-server-runtimes-generated-types'
13+
export { InsertToCursorPositionParams } from '@local/language-server-runtimes-generated-types'
1514

1615
export type AuthFollowUpType = 'full-auth' | 're-auth' | 'missing_scopes' | 'use-supported-auth'
1716
export function isValidAuthFollowUpType(value: string): value is AuthFollowUpType {

package-lock.json

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
],
1212
"workspaces": [
1313
"types",
14+
"types/codegen/generated",
1415
"runtimes",
1516
"chat-client-ui-types"
1617
],
@@ -36,7 +37,8 @@
3637
"test": "npm run test --workspaces --if-present",
3738
"preversion": "npm run test",
3839
"version": "npm run compile && git add -A .",
39-
"watch": "tsc --build --watch"
40+
"watch": "tsc --build --watch",
41+
"gen-comp": "cd ./types/codegen/ && npm run generate && cd ./generated && npm run build && cd ../../../ && npm run compile"
4042
},
4143
"devDependencies": {
4244
"@commitlint/cli": "^19.8.1",

runtimes/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"dependencies": {
3333
"@aws/language-server-runtimes-types": "^0.1.56",
34+
"@local/language-server-runtimes-generated-types": "file:/Users/conorstw/Desktop/language-server-runtimes/types/codegen/generated",
3435
"@opentelemetry/api": "^1.9.0",
3536
"@opentelemetry/api-logs": "^0.200.0",
3637
"@opentelemetry/core": "^2.0.0",

runtimes/protocol/chat.ts

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
import {
2-
ChatParams,
3-
ChatResult,
4-
EndChatParams,
5-
EndChatResult,
6-
FeedbackParams,
7-
FollowUpClickParams,
8-
InfoLinkClickParams,
9-
InsertToCursorPositionParams,
10-
LinkClickParams,
11-
QuickActionParams,
12-
SourceLinkClickParams,
13-
TabAddParams,
14-
TabChangeParams,
15-
TabRemoveParams,
162
ProtocolNotificationType,
173
ProtocolRequestType,
184
CHAT_REQUEST_METHOD,
@@ -29,63 +15,80 @@ import {
2915
TAB_CHANGE_NOTIFICATION_METHOD,
3016
TAB_REMOVE_NOTIFICATION_METHOD,
3117
AutoParameterStructuresProtocolRequestType,
18+
OPEN_TAB_REQUEST_METHOD,
19+
CHAT_UPDATE_NOTIFICATION_METHOD,
20+
FILE_CLICK_NOTIFICATION_METHOD,
21+
INLINE_CHAT_REQUEST_METHOD,
22+
CONTEXT_COMMAND_NOTIFICATION_METHOD,
23+
CREATE_PROMPT_NOTIFICATION_METHOD,
24+
INLINE_CHAT_RESULT_NOTIFICATION_METHOD,
25+
PINNED_CONTEXT_NOTIFICATION_METHOD,
26+
LIST_CONVERSATIONS_REQUEST_METHOD,
27+
CONVERSATION_CLICK_REQUEST_METHOD,
28+
GET_SERIALIZED_CHAT_REQUEST_METHOD,
29+
TAB_BAR_ACTION_REQUEST_METHOD,
30+
CHAT_OPTIONS_UPDATE_NOTIFICATION_METHOD,
31+
PROMPT_INPUT_OPTION_CHANGE_METHOD,
32+
BUTTON_CLICK_REQUEST_METHOD,
33+
LIST_MCP_SERVERS_REQUEST_METHOD,
34+
MCP_SERVER_CLICK_REQUEST_METHOD,
35+
RULE_CLICK_REQUEST_METHOD,
36+
LIST_RULES_REQUEST_METHOD,
37+
PINNED_CONTEXT_ADD_NOTIFICATION_METHOD,
38+
PINNED_CONTEXT_REMOVE_NOTIFICATION_METHOD,
39+
ACTIVE_EDITOR_CHANGED_NOTIFICATION_METHOD,
40+
OPEN_FILE_DIALOG_METHOD,
41+
} from './lsp'
42+
43+
import {
44+
ChatParams,
45+
ChatResult,
46+
EndChatParams,
47+
EndChatResult,
48+
FeedbackParams,
49+
FollowUpClickParams,
50+
InfoLinkClickParams,
51+
InsertToCursorPositionParams,
52+
LinkClickParams,
53+
QuickActionParams,
54+
SourceLinkClickParams,
55+
TabAddParams,
56+
TabChangeParams,
57+
TabRemoveParams,
3258
EncryptedChatParams,
3359
EncryptedQuickActionParams,
3460
QuickActionResult,
35-
OPEN_TAB_REQUEST_METHOD,
3661
OpenTabParams,
3762
OpenTabResult,
38-
CHAT_UPDATE_NOTIFICATION_METHOD,
39-
FILE_CLICK_NOTIFICATION_METHOD,
4063
ChatUpdateParams,
4164
FileClickParams,
42-
INLINE_CHAT_REQUEST_METHOD,
4365
InlineChatParams,
4466
InlineChatResult,
45-
CONTEXT_COMMAND_NOTIFICATION_METHOD,
4667
ContextCommandParams,
47-
CREATE_PROMPT_NOTIFICATION_METHOD,
4868
CreatePromptParams,
49-
INLINE_CHAT_RESULT_NOTIFICATION_METHOD,
50-
PINNED_CONTEXT_NOTIFICATION_METHOD,
5169
InlineChatResultParams,
5270
ListConversationsParams,
5371
ListConversationsResult,
54-
LIST_CONVERSATIONS_REQUEST_METHOD,
5572
ConversationClickParams,
5673
ConversationClickResult,
57-
CONVERSATION_CLICK_REQUEST_METHOD,
5874
GetSerializedChatParams,
5975
GetSerializedChatResult,
60-
GET_SERIALIZED_CHAT_REQUEST_METHOD,
6176
TabBarActionParams,
6277
TabBarActionResult,
63-
TAB_BAR_ACTION_REQUEST_METHOD,
6478
ChatOptionsUpdateParams,
65-
CHAT_OPTIONS_UPDATE_NOTIFICATION_METHOD,
6679
PromptInputOptionChangeParams,
67-
PROMPT_INPUT_OPTION_CHANGE_METHOD,
6880
ButtonClickParams,
6981
ButtonClickResult,
70-
BUTTON_CLICK_REQUEST_METHOD,
7182
ListMcpServersParams,
7283
ListMcpServersResult,
73-
LIST_MCP_SERVERS_REQUEST_METHOD,
84+
ListRulesResult,
85+
RuleClickResult,
86+
PinnedContextParams,
7487
McpServerClickParams,
7588
McpServerClickResult,
76-
MCP_SERVER_CLICK_REQUEST_METHOD,
7789
ListRulesParams,
7890
RuleClickParams,
79-
RULE_CLICK_REQUEST_METHOD,
80-
LIST_RULES_REQUEST_METHOD,
81-
ListRulesResult,
82-
RuleClickResult,
83-
PinnedContextParams,
84-
PINNED_CONTEXT_ADD_NOTIFICATION_METHOD,
85-
PINNED_CONTEXT_REMOVE_NOTIFICATION_METHOD,
8691
ActiveEditorChangedParams,
87-
ACTIVE_EDITOR_CHANGED_NOTIFICATION_METHOD,
88-
OPEN_FILE_DIALOG_METHOD,
8992
OpenFileDialogParams,
9093
OpenFileDialogResult,
9194
LIST_AVAILABLE_MODELS_REQUEST_METHOD,

runtimes/protocol/lsp.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import {
1212
RegistrationType,
1313
RequestType,
1414
} from 'vscode-languageserver-protocol'
15-
import { ChatOptions } from '@aws/language-server-runtimes-types'
15+
import { ChatOptions } from '@local/language-server-runtimes-generated-types'
1616
import { LogLevel } from '../runtimes/util/loggingUtil'
1717

18+
//Changed so only METHODS are exported from ./chat
1819
export * from '@aws/language-server-runtimes-types'
20+
21+
export * from '@local/language-server-runtimes-generated-types'
1922
export { TextDocument } from 'vscode-languageserver-textdocument'
2023

2124
// LSP protocol is a core dependency for LSP feature provided by runtimes.

types/codegen/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export type EndChatResult = boolean
2+
export type FilterValue = string

types/codegen/custom-templates/models.index.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* tslint:disable */
22
/* eslint-disable */
3-
import { Position, Range, TextDocumentIdentifier } from '../../../../lsp'
3+
import { Position, Range, TextDocumentIdentifier } from 'vscode-languageserver-types'
44

55
{{#models}}
66
{{#model}}

types/codegen/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"build": "tsc",
88
"test": "echo \"Error: no test specified\" && exit 1",
99
"generate": "openapi-generator-cli generate && node post-generate.js",
10+
"generate:build": "npm run generate",
1011
"generate:direct": "openapi-generator-cli generate -g typescript-fetch -i schema/chatTypes.json -o generated -t custom-templates --additional-properties=supportsES6=true,modelPropertyNaming=original,enumPropertyNaming=original,npmName=@json-schema-openapi/generated,npmVersion=1.0.0,withInterfaces=true,nullSafeAdditionalProps=true,withoutRuntimeChecks=true,stringEnums=true,disallowAdditionalPropertiesIfNotPresent=false,useSingleRequestParameter=true && node post-generate.js",
11-
"validate": "ts-node src/validate-generated.ts"
12+
"validate": "ts-node validate.ts"
1213
},
1314
"keywords": [
1415
"openapi",

0 commit comments

Comments
 (0)