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

Bump prettier from 2.8.8 to 3.0.0 #705

Merged
merged 5 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"no-template-curly-in-string": "warn",
"eqeqeq": "error",
"no-invalid-this": "error",
"no-lonely-if": "error"
"no-lonely-if": "error",
"max-len": ["error", { "code": 120 }]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class MyApi implements TemeletryApi {
// Register the command to return an object of the API
vscode.commands.registerCommand(
"ruby-lsp.getPrivateTelemetryApi",
() => new MyApi()
() => new MyApi(),
Copy link
Contributor

@andyw8 andyw8 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it interesting that yarn run format handled this change even though it's in the README.

);
```

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,10 @@
"esbuild": "^0.18.14",
"eslint": "^8.45.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-prettier": "^5.0.0",
"glob": "^10.3.0",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
},
"dependencies": {
Expand Down
66 changes: 33 additions & 33 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class Client implements ClientInterface {
context: vscode.ExtensionContext,
telemetry: Telemetry,
ruby: Ruby,
testController: TestController
testController: TestController,
) {
this.workingFolder = vscode.workspace.workspaceFolders![0].uri.fsPath;
this.telemetry = telemetry;
Expand All @@ -70,8 +70,8 @@ export default class Client implements ClientInterface {
this.state = ServerState.Starting;

try {
// When using a custom bundle path that is not our default, then we shouldn't create the .ruby-lsp folder or try to
// install gems
// When using a custom bundle path that is not our default, then we shouldn't create the .ruby-lsp folder or try
// to install gems
const customBundleGemfile: string = vscode.workspace
.getConfiguration("rubyLsp")
.get("bundleGemfile")!;
Expand All @@ -85,7 +85,7 @@ export default class Client implements ClientInterface {
// The progress dialog can't be closed by the user, so we have to guarantee that we catch errors
vscode.window.showErrorMessage(
`Failed to setup the bundle: ${error.message}. \
See [Troubleshooting](https://github.com/Shopify/vscode-ruby-lsp#troubleshooting) for instructions`
See [Troubleshooting](https://github.com/Shopify/vscode-ruby-lsp#troubleshooting) for instructions`,
);

return;
Expand Down Expand Up @@ -117,7 +117,7 @@ export default class Client implements ClientInterface {
initializationOptions: {
enabledFeatures: this.listOfEnabledFeatures(),
experimentalFeaturesEnabled: configuration.get(
"enableExperimentalFeatures"
"enableExperimentalFeatures",
),
formatter: configuration.get("formatter"),
},
Expand All @@ -131,7 +131,7 @@ export default class Client implements ClientInterface {

if (response) {
const testLenses = response.filter(
(codeLens) => (codeLens as CodeLens).data.type === "test"
(codeLens) => (codeLens as CodeLens).data.type === "test",
) as CodeLens[];

if (testLenses.length) {
Expand All @@ -147,7 +147,7 @@ export default class Client implements ClientInterface {
ch,
options,
token,
_next
_next,
) => {
if (this.client) {
const response: vscode.TextEdit[] | null =
Expand All @@ -159,7 +159,7 @@ export default class Client implements ClientInterface {
ch,
options,
},
token
token,
);

if (!response) {
Expand All @@ -168,7 +168,7 @@ export default class Client implements ClientInterface {

// Find the $0 anchor to move the cursor
const cursorPosition = response.find(
(edit) => edit.newText === "$0"
(edit) => edit.newText === "$0",
);

if (!cursorPosition) {
Expand All @@ -186,8 +186,8 @@ export default class Client implements ClientInterface {
new vscode.SnippetString(cursorPosition.newText),
new vscode.Selection(
cursorPosition.range.start,
cursorPosition.range.end
)
cursorPosition.range.end,
),
);

return null;
Expand All @@ -201,7 +201,7 @@ export default class Client implements ClientInterface {
this.client = new LanguageClient(
LSP_NAME,
{ run: executable, debug: debugExecutable },
clientOptions
clientOptions,
);

const baseFolder = path.basename(this.workingFolder);
Expand All @@ -213,7 +213,7 @@ export default class Client implements ClientInterface {
(baseFolder === "ruby-lsp" || baseFolder === "ruby-lsp-rails")
) {
vscode.window.showErrorMessage(
`Ruby LSP error ${event.errorClass}: ${event.errorMessage}`
`Ruby LSP error ${event.errorClass}: ${event.errorMessage}`,
);
} else {
this.telemetry.sendEvent({
Expand Down Expand Up @@ -263,7 +263,7 @@ export default class Client implements ClientInterface {
this.state = ServerState.Error;

this.outputChannel.appendLine(
`Error restarting the server: ${error.message}`
`Error restarting the server: ${error.message}`,
);
}
}
Expand Down Expand Up @@ -326,16 +326,16 @@ export default class Client implements ClientInterface {
vscode.commands.registerCommand(Command.Stop, this.stop.bind(this)),
vscode.commands.registerCommand(
Command.Update,
this.updateServer.bind(this)
this.updateServer.bind(this),
),
vscode.commands.registerCommand(
Command.OpenLink,
this.openLink.bind(this)
this.openLink.bind(this),
),
vscode.commands.registerCommand(
Command.ShowSyntaxTree,
this.showSyntaxTree.bind(this)
)
this.showSyntaxTree.bind(this),
),
);
}

Expand Down Expand Up @@ -400,13 +400,13 @@ export default class Client implements ClientInterface {
fs.writeFileSync(customGemfilePath, gemfile.join("\n"));

const lastUpdatedAt: number | undefined = this.context.workspaceState.get(
"rubyLsp.lastBundleInstall"
"rubyLsp.lastBundleInstall",
);
const gemfileLockPath = path.join(this.workingFolder, "Gemfile.lock");
const customGemfileLockPath = path.join(
this.workingFolder,
".ruby-lsp",
"Gemfile.lock"
"Gemfile.lock",
);

// Copy the Gemfile.lock and install gems to get `ruby-lsp` updates if
Expand Down Expand Up @@ -443,7 +443,7 @@ export default class Client implements ClientInterface {

private createRestartWatcher(pattern: string) {
const watcher = vscode.workspace.createFileSystemWatcher(
new vscode.RelativePattern(this.workingFolder, pattern)
new vscode.RelativePattern(this.workingFolder, pattern),
);
this.context.subscriptions.push(watcher);

Expand Down Expand Up @@ -472,7 +472,7 @@ export default class Client implements ClientInterface {
{
cwd: this.workingFolder,
env: withoutBundleGemfileEnv,
}
},
);
return true;
} catch (error) {
Expand All @@ -494,7 +494,7 @@ export default class Client implements ClientInterface {

private gemfilesAreOutOfSync(
gemfileLockPath: string,
customGemfileLockPath: string
customGemfileLockPath: string,
): boolean {
// If there's no top level Gemfile.lock, there's nothing to sync
if (!fs.existsSync(gemfileLockPath)) {
Expand All @@ -518,7 +518,7 @@ export default class Client implements ClientInterface {
const customGemfileLockPath = path.join(
this.workingFolder,
".ruby-lsp",
"Gemfile.lock"
"Gemfile.lock",
);

// Copy the current `Gemfile.lock` to the `.ruby-lsp` directory to make sure we're using the right versions of
Expand All @@ -534,7 +534,7 @@ export default class Client implements ClientInterface {
const customGemfilePath = path.join(
this.workingFolder,
".ruby-lsp",
"Gemfile"
"Gemfile",
);

await vscode.window.withProgress(
Expand All @@ -561,7 +561,7 @@ export default class Client implements ClientInterface {
progress,
token: this.bundleInstallCancellationSource.token,
});
}
},
);

// Update the last time we checked for updates
Expand All @@ -573,7 +573,7 @@ export default class Client implements ClientInterface {
options?: {
progress?: vscode.Progress<{ message?: string }>;
token?: vscode.CancellationToken;
}
},
) {
const env = { ...this.ruby.env, BUNDLE_GEMFILE: bundleGemfile };

Expand Down Expand Up @@ -622,7 +622,7 @@ export default class Client implements ClientInterface {
stderr.close();

this.outputChannel.appendLine(
`>> \`bundle install\` exited with code ${code}`
`>> \`bundle install\` exited with code ${code}`,
);

if (code === 0) {
Expand Down Expand Up @@ -656,12 +656,12 @@ export default class Client implements ClientInterface {
bundleGemfile = `BUNDLE_GEMFILE=${path.join(
this.workingFolder,
".ruby-lsp",
"Gemfile"
"Gemfile",
)}`;
} else {
bundleGemfile = `BUNDLE_GEMFILE=${path.join(
this.workingFolder,
"Gemfile"
"Gemfile",
)}`;
}

Expand All @@ -670,7 +670,7 @@ export default class Client implements ClientInterface {
{
cwd: this.workingFolder,
env: this.ruby.env,
}
},
);

return result.stdout;
Expand Down Expand Up @@ -706,7 +706,7 @@ export default class Client implements ClientInterface {

const response: SyntaxTreeResponse = await this.client.sendRequest(
"rubyLsp/textDocument/showSyntaxTree",
{ textDocument: { uri: activeEditor.document.uri.toString() } }
{ textDocument: { uri: activeEditor.document.uri.toString() } },
);

if (response) {
Expand All @@ -715,7 +715,7 @@ export default class Client implements ClientInterface {
scheme: "ruby-lsp",
path: "show-syntax-tree",
query: response.ast,
})
}),
);

await vscode.window.showTextDocument(document, {
Expand Down
26 changes: 13 additions & 13 deletions src/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Debugger
constructor(
context: vscode.ExtensionContext,
ruby: Ruby,
workingFolder = vscode.workspace.workspaceFolders![0].uri.fsPath
workingFolder = vscode.workspace.workspaceFolders![0].uri.fsPath,
) {
this.ruby = ruby;
this.subscriptions = [
Expand All @@ -36,7 +36,7 @@ export class Debugger
// process that was already booted with the debugger
async createDebugAdapterDescriptor(
session: vscode.DebugSession,
_executable: vscode.DebugAdapterExecutable
_executable: vscode.DebugAdapterExecutable,
): Promise<vscode.DebugAdapterDescriptor | undefined> {
if (session.configuration.request === "launch") {
return this.spawnDebuggeeForLaunch(session);
Expand All @@ -46,16 +46,16 @@ export class Debugger
return new Promise((_resolve, reject) =>
reject(
new Error(
`Unknown request type: ${session.configuration.request}. Please review your launch configurations`
)
)
`Unknown request type: ${session.configuration.request}. Please review your launch configurations`,
),
),
);
}
}

provideDebugConfigurations?(
_folder: vscode.WorkspaceFolder | undefined,
_token?: vscode.CancellationToken
_token?: vscode.CancellationToken,
): vscode.ProviderResult<vscode.DebugConfiguration[]> {
return [
{
Expand Down Expand Up @@ -86,13 +86,13 @@ export class Debugger
resolveDebugConfiguration?(
_folder: vscode.WorkspaceFolder | undefined,
debugConfiguration: vscode.DebugConfiguration,
_token?: vscode.CancellationToken
_token?: vscode.CancellationToken,
): vscode.ProviderResult<vscode.DebugConfiguration> {
if (debugConfiguration.env) {
// If the user has their own debug launch configurations, we still need to inject the Ruby environment
debugConfiguration.env = Object.assign(
debugConfiguration.env,
this.ruby.env
this.ruby.env,
);
} else {
debugConfiguration.env = this.ruby.env;
Expand Down Expand Up @@ -134,16 +134,16 @@ export class Debugger
} else {
resolve(
new vscode.DebugAdapterNamedPipeServer(
path.join(socketsDir, selectedSocket)
)
path.join(socketsDir, selectedSocket),
),
);
}
});
});
}

private spawnDebuggeeForLaunch(
session: vscode.DebugSession
session: vscode.DebugSession,
): Promise<vscode.DebugAdapterDescriptor | undefined> {
let initialMessage = "";
let initialized = false;
Expand All @@ -166,7 +166,7 @@ export class Debugger
shell: true,
env: configuration.env,
cwd: this.workingFolder,
}
},
);

this.debugProcess.stderr.on("data", (data) => {
Expand Down Expand Up @@ -231,7 +231,7 @@ export class Debugger
if (existingSockets.length > 0) {
socketIndex =
Number(
existingSockets[existingSockets.length - 1].match(/-(\d+).sock$/)![1]
existingSockets[existingSockets.length - 1].match(/-(\d+).sock$/)![1],
) + 1;
}

Expand Down
Loading