small fixes to remove as never
This commit is contained in:
1 file changed
+17
-15
+17
-15
@@ -25,6 +25,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
CancellationTokenSource,
|
CancellationTokenSource,
|
||||||
type ClientCapabilities,
|
type ClientCapabilities,
|
||||||
|
type CompletionItemKind,
|
||||||
ConfigurationRequest,
|
ConfigurationRequest,
|
||||||
createMessageConnection,
|
createMessageConnection,
|
||||||
DidChangeConfigurationNotification,
|
DidChangeConfigurationNotification,
|
||||||
@@ -46,6 +47,7 @@ import {
|
|||||||
ShutdownRequest,
|
ShutdownRequest,
|
||||||
StreamMessageReader,
|
StreamMessageReader,
|
||||||
StreamMessageWriter,
|
StreamMessageWriter,
|
||||||
|
type SymbolKind,
|
||||||
UnregistrationRequest,
|
UnregistrationRequest,
|
||||||
WorkDoneProgressCreateRequest,
|
WorkDoneProgressCreateRequest,
|
||||||
WorkspaceFoldersRequest,
|
WorkspaceFoldersRequest,
|
||||||
@@ -87,8 +89,8 @@ export class LanguageServer extends Context.Service<
|
|||||||
readonly root: string;
|
readonly root: string;
|
||||||
readonly capabilities: ServerCapabilities;
|
readonly capabilities: ServerCapabilities;
|
||||||
readonly serverInfo:
|
readonly serverInfo:
|
||||||
| { readonly name: string; readonly version?: string | undefined }
|
| { readonly name: string; readonly version?: string | undefined }
|
||||||
| undefined;
|
| undefined;
|
||||||
readonly request: <P, R>(
|
readonly request: <P, R>(
|
||||||
type: RequestType<P, R, unknown>,
|
type: RequestType<P, R, unknown>,
|
||||||
params: P,
|
params: P,
|
||||||
@@ -198,9 +200,9 @@ const make = Effect.fn("LanguageServer.make")(function* (options: Options) {
|
|||||||
error instanceof ResponseError
|
error instanceof ResponseError
|
||||||
? new LspError({ method, message: error.message, code: error.code })
|
? new LspError({ method, message: error.message, code: error.code })
|
||||||
: new LspError({
|
: new LspError({
|
||||||
method,
|
method,
|
||||||
message: error instanceof Error ? error.message : String(error),
|
message: error instanceof Error ? error.message : String(error),
|
||||||
});
|
});
|
||||||
|
|
||||||
const send = <P, R>(type: RequestType<P, R, unknown>, params: P) =>
|
const send = <P, R>(type: RequestType<P, R, unknown>, params: P) =>
|
||||||
Effect.callback<R, LspError>((resume) => {
|
Effect.callback<R, LspError>((resume) => {
|
||||||
@@ -261,9 +263,9 @@ const make = Effect.fn("LanguageServer.make")(function* (options: Options) {
|
|||||||
error instanceof ResponseError
|
error instanceof ResponseError
|
||||||
? error
|
? error
|
||||||
: new ResponseError(
|
: new ResponseError(
|
||||||
ErrorCodes.InternalError,
|
ErrorCodes.InternalError,
|
||||||
error instanceof Error ? error.message : String(error),
|
error instanceof Error ? error.message : String(error),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
) as Promise<never>,
|
) as Promise<never>,
|
||||||
@@ -338,11 +340,11 @@ const section = (settings: unknown, path: string | undefined): LSPAny =>
|
|||||||
(path === undefined
|
(path === undefined
|
||||||
? settings
|
? settings
|
||||||
: path
|
: path
|
||||||
.split(".")
|
.split(".")
|
||||||
.reduce<unknown>(
|
.reduce<unknown>(
|
||||||
(value, key) => (value as Record<string, unknown> | null)?.[key],
|
(value, key) => (value as Record<string, unknown> | null)?.[key],
|
||||||
settings,
|
settings,
|
||||||
)) as LSPAny;
|
)) as LSPAny;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What we tell the server we can do. Deliberately narrow: no dynamic
|
* What we tell the server we can do. Deliberately narrow: no dynamic
|
||||||
@@ -393,7 +395,7 @@ const clientCapabilities: ClientCapabilities = {
|
|||||||
deprecatedSupport: true,
|
deprecatedSupport: true,
|
||||||
},
|
},
|
||||||
completionItemKind: {
|
completionItemKind: {
|
||||||
valueSet: Array.from({ length: 25 }, (_, i) => (i + 1) as never),
|
valueSet: Array.from({ length: 25 }, (_, i) => (i + 1) as CompletionItemKind),
|
||||||
},
|
},
|
||||||
contextSupport: true,
|
contextSupport: true,
|
||||||
},
|
},
|
||||||
@@ -440,5 +442,5 @@ const clientCapabilities: ClientCapabilities = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function allSymbolKinds() {
|
function allSymbolKinds() {
|
||||||
return Array.from({ length: 26 }, (_, i) => (i + 1) as never);
|
return Array.from({ length: 26 }, (_, i) => (i + 1) as SymbolKind);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user