Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Fix Record index violations
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Dec 11, 2023
1 parent 1c123a9 commit 8817110
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import { LOG_CHANNEL, LSP_NAME, ClientInterface } from "./common";
import { Telemetry, RequestEvent } from "./telemetry";
import { Ruby } from "./ruby";

interface EnabledFeatures {
[key: string]: boolean;
}
type EnabledFeatures = Record<string, boolean>;

// Get the executables to start the server based on the user's configuration
function getLspExecutables(
Expand Down
4 changes: 2 additions & 2 deletions src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ export class RubyLsp {
.contributes.configuration.properties["rubyLsp.enabledFeatures"]
.properties;

const descriptions: { [key: string]: string } = {};
const descriptions: Record<string, string> = {};
Object.entries(enabledFeaturesProperties).forEach(
([key, value]: [string, any]) => {
descriptions[key] = value.description;
},
);

const configuration = vscode.workspace.getConfiguration("rubyLsp");
const features: { [key: string]: boolean } =
const features: Record<string, boolean> =
configuration.get("enabledFeatures")!;
const allFeatures = Object.keys(features);
const options: vscode.QuickPickItem[] = allFeatures.map((label) => {
Expand Down
2 changes: 1 addition & 1 deletion src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class FeaturesStatus extends StatusItem {

refresh(_workspace: WorkspaceInterface): void {
const configuration = vscode.workspace.getConfiguration("rubyLsp");
const features: { [key: string]: boolean } =
const features: Record<string, boolean> =
configuration.get("enabledFeatures")!;
const enabledFeatures = Object.keys(features).filter(
(key) => features[key],
Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ suite("StatusItems", () => {

suite("FeaturesStatus", () => {
const configuration = vscode.workspace.getConfiguration("rubyLsp");
const originalFeatures: { [key: string]: boolean } =
const originalFeatures: Record<string, boolean> =
configuration.get("enabledFeatures")!;
const numberOfExperimentalFeatures = Object.values(originalFeatures).filter(
(feature) => feature === false,
Expand Down Expand Up @@ -256,7 +256,7 @@ suite("StatusItems", () => {
.getConfiguration("rubyLsp")
.update("enabledFeatures", { completion: false }, true, true);

const currentFeatures: { [key: string]: boolean } = vscode.workspace
const currentFeatures: Record<string, boolean> = vscode.workspace
.getConfiguration("rubyLsp")
.get("enabledFeatures")!;

Expand Down
2 changes: 1 addition & 1 deletion src/testController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TestController {
this.testCommands.delete(test);
});

const groupIdMap: { [key: string]: vscode.TestItem } = {};
const groupIdMap: Record<string, vscode.TestItem> = {};
let classTest: vscode.TestItem;

const uri = vscode.Uri.from({
Expand Down

0 comments on commit 8817110

Please sign in to comment.