-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor project structure #76
Changes from 12 commits
91f0411
e3fd81f
b5ddfd6
d07ffd4
c282dc8
15f820a
88dc846
9afa68a
3c74fee
2eddfe7
f61e76c
cb6dc14
b0550f3
9dc5d7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@amzn/language-server-runtimes-impl", | ||
"private": true, | ||
"description": "Helper file to flatten import paths in dependant packages", | ||
"main": "../out/runtimes/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@amzn/language-server-runtimes-protocol", | ||
"private": true, | ||
"description": "Helper file to flatten import paths in dependant packages", | ||
"main": "../out/protocol/index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@amzn/language-server-runtimes-server-interface", | ||
"private": true, | ||
"description": "Helper file to flatten import paths in dependant packages", | ||
"main": "../out/server-interface/index.js" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## AWS Language Servers Runtimes Protocol | ||
|
||
Implementation of AWS Language Servers Runtimes Protocol, which defines a protocol for communication between Servers and Clients. | ||
It is modelled after LSP, and provides several custom extensions to enable custom AWS Language Server Runtimes features. | ||
|
||
Protocol specification can be found in main [README](https://github.com/aws/language-server-runtimes/blob/main/README.md). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ProtocolRequestType, ProtocolNotificationType0, ProtocolRequestType0 } from './lsp' | ||
|
||
export type IamCredentials = { | ||
readonly accessKeyId: string | ||
readonly secretAccessKey: string | ||
readonly sessionToken?: string | ||
} | ||
|
||
export type BearerCredentials = { | ||
readonly token: string | ||
} | ||
|
||
export interface SsoProfileData { | ||
startUrl?: string | ||
} | ||
|
||
export interface ConnectionMetadata { | ||
sso?: SsoProfileData | ||
} | ||
|
||
export interface UpdateCredentialsParams { | ||
// Plaintext Credentials (for browser based environments) or encrypted JWT token | ||
data: IamCredentials | BearerCredentials | string | ||
// If the payload is encrypted | ||
// Defaults to false if undefined or null | ||
encrypted?: boolean | ||
} | ||
|
||
export const iamCredentialsUpdateRequestType = new ProtocolRequestType<UpdateCredentialsParams, null, void, void, void>( | ||
'aws/credentials/iam/update' | ||
) | ||
|
||
export const iamCredentialsDeleteNotificationType = new ProtocolNotificationType0<void>('aws/credentials/iam/delete') | ||
|
||
export const bearerCredentialsUpdateRequestType = new ProtocolRequestType< | ||
UpdateCredentialsParams, | ||
null, | ||
void, | ||
void, | ||
void | ||
>('aws/credentials/token/update') | ||
|
||
export const bearerCredentialsDeleteNotificationType = new ProtocolNotificationType0<void>( | ||
'aws/credentials/token/delete' | ||
) | ||
|
||
export const getConnectionMetadataRequestType = new ProtocolRequestType0<ConnectionMetadata, never, void, void>( | ||
'aws/credentials/getConnectionMetadata' | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './lsp' | ||
export * from './auth' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ import { | |
InlineCompletionItem, | ||
InlineCompletionList, | ||
InlineCompletionParams, | ||
InlineCompletionRegistrationOptions, | ||
ProtocolRequestType, | ||
} from 'vscode-languageserver' | ||
InlineCompletionRegistrationOptions, | ||
} from './lsp' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there still a copy/paste here from the 3.18 branch of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, 3.18 LSP is not yet published |
||
|
||
/** | ||
* inlineCompletionRequestType defines the custom method that the language client | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export { TextDocument, Position } from 'vscode-languageserver-textdocument' | ||
|
||
// LSP protocol is a core dependency for LSP feature provided by runtimes. | ||
// Since we aim to provide whole range of LSP specification for Clients and Capabilities, | ||
// we re-exporting whole LSP protocol for usage. | ||
// Scoping it down is not practical due to large surface of protocol and types relationship. | ||
// It will be limiting implementors, if they choose to type their code with more specific types from LSP. | ||
export * from 'vscode-languageserver-protocol' | ||
|
||
// Custom Runtimes LSP extensions | ||
export * from './inlineCompletions' | ||
export * from './inlineCompletionWithReferences' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## AWS Language Server Runtimes Implementation | ||
|
||
Implementation of AWS Language Server runtimes and Runtimes features. | ||
|
||
Each runtime implements a LSP server and opens communication channel with client over LSP connection. Runtime initialised all registered Capabilities. | ||
|
||
Runtime sets up message passing, that translates Runtimes Protocol messages to a function calls to Capabilities features, defined in Server and server features interfaces. | ||
|
||
Runtime implementation acts as a intermediate layer between Runtime Client and a Runtime Servers, injected into runtime at build time. | ||
The runtime implements message passing between Client application and injected Servers, and interface with both by predefined APIs: | ||
* **Runtime Protocol**: a protocol to define communication between Runtime and Client application (e.g. Runtime<->AWS Toolkit extension). It uses LSP (and JSON-RPC) connection as a transport. | ||
* **Runtime Server Interface**: defines an interface of the Server and features exposed to Runtime Server developers (e.g. Runtime<->AWS CodeWhisperer server). | ||
|
||
|
||
See main project [README](https://github.com/aws/language-server-runtimes/blob/main/README.md) for more detailed explanation of the architecture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative is to publish to npm from
out
directory, but I'm not convinced which way is better https://davidwells.io/blog/publishing-flat-npm-packages-for-easier-import-paths-smaller-consumer-bundle-sizesSo I preferred explicit config here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in favour of publishing from
/out
folder and using helper scripts instead of aux files.