-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: add toPipe and fromPipe commands #182
Merged
lukaszsamson
merged 9 commits into
elixir-lsp:master
from
polvalente:feat/add-pipe-and-unpipe
Dec 14, 2021
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1d5ec47
feat: add command declarations to package json
polvalente b327e2e
feat: add fromPipe and toPipe commands
polvalente 146065c
chore: revert stray change
polvalente b11ed88
fix: accept empty selection
polvalente 04310d1
fix: remove unused code
polvalente e985748
chore: comply with code review
polvalente 4944fa7
Merge branch 'master' into feat/add-pipe-and-unpipe
polvalente 49d1b31
fix: define uri again
polvalente 2e1546a
Merge branch 'master' into feat/add-pipe-and-unpipe
polvalente File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,41 @@ function configureExpandMacro(context: ExtensionContext) { | |
context.subscriptions.push(disposable); | ||
} | ||
|
||
function configureManipulatePipes(context: ExtensionContext, operation: "toPipe" | "fromPipe") { | ||
const commandName = `extension.${operation}`; | ||
|
||
const disposable = vscode.commands.registerCommand(commandName, async () => { | ||
const extension = vscode.extensions.getExtension("jakebecker.elixir-ls"); | ||
const editor = vscode.window.activeTextEditor; | ||
if (!extension || !editor) { | ||
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 the extension check necessary? 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. Not exactly, this just fails faster upon a bizarre error, if that makes sense. I can remove it if you prefer |
||
return; | ||
} | ||
|
||
const client = getClient(editor.document); | ||
const uri = editor.document.uri | ||
|
||
if (!client) { | ||
return | ||
} | ||
|
||
|
||
const command = client.initializeResult!.capabilities.executeCommandProvider!.commands | ||
.find((c: string) => c.startsWith('manipulatePipes:'))!; | ||
|
||
const uriStr = uri.toString(); | ||
const args = [ | ||
operation, | ||
uriStr, | ||
editor.selection.start.line, | ||
editor.selection.start.character, | ||
]; | ||
|
||
const params: ExecuteCommandParams = { command, arguments: args }; | ||
|
||
client.sendRequest("workspace/executeCommand", params); | ||
}); | ||
} | ||
|
||
class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescriptorFactory { | ||
createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable): vscode.ProviderResult<vscode.DebugAdapterDescriptor> { | ||
if (session.workspaceFolder) { | ||
|
@@ -330,7 +365,6 @@ function startClient(context: ExtensionContext, clientOptions: LanguageClientOpt | |
} | ||
|
||
export function activate(context: ExtensionContext): void { | ||
console.warn("activate called"); | ||
testElixir(); | ||
detectConflictingExtension("mjmcloug.vscode-elixir"); | ||
// https://github.com/elixir-lsp/vscode-elixir-ls/issues/34 | ||
|
@@ -339,6 +373,8 @@ export function activate(context: ExtensionContext): void { | |
configureRunTestFromCodeLens() | ||
configureCopyDebugInfo(context); | ||
configureExpandMacro(context); | ||
configureManipulatePipes(context, "fromPipe"); | ||
configureManipulatePipes(context, "toPipe"); | ||
configureDebugger(context); | ||
configureTerminalLinkProvider(context); | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looking at line 415, this seemed to need a fix