Skip to content
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(diff): diff without producing temporary files #128

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module.exports = {
'!.*rc.*',
'!*.config.js',
'!*.d.ts',

// Ignore, since this file is vendored from VSCode and should not be changed.
// See `CONTRIBUTING.md`.
'src/types/git.ts',
Copy link
Collaborator

@maninak maninak May 30, 2024

Choose a reason for hiding this comment

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

If the file only requires auto-fixable issues, it's preferable to just apply them, and not add this ignore.

If that's not the case then let's go with the contents as they are.

],
rules: {
/*
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,16 @@ npx vsce package --no-dependencies
```

This should generate a .vsix file which you can then import into VS Code (`Ctrl + Shift + P` + "install vsix").

## Vendored Dependencies

Types for the [Git integration for VSCode](https://github.com/microsoft/vscode/tree/main/extensions/git) are vendored at [`src/types/git.ts`](src/types/git.ts).

To update those, proceed as follows:

```sh
$ export VSCODE_TAG="1.88.1" # Adjust this to match desired version of VSCode.
$ git remote add vscode "https://github.com/microsoft/vscode.git"
$ git fetch --depth 1 vscode "$VSCODE_TAG"
$ git show $(git ls-remote --refs --tags vscode "$VSCODE_TAG" | cut -d$'\t' -f1):extensions/git/src/api/git.ts > src/types/git.ts
```
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,9 @@
"ts-xor": "^1.3.0",
"typescript": "^5.3.3"
},
"extensionDependencies": [
"vscode.git"
],
"simple-git-hooks": {
"pre-commit": "npm run lint"
},
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type TextDocumentShowOptions, Uri, commands, window } from 'vscode'
import { type TextDocumentShowOptions, type Uri, commands, window } from 'vscode'
import { getExtensionContext, usePatchStore } from '../stores'
import { exec, log, showLog } from '../utils'
import {
Expand Down Expand Up @@ -122,8 +122,8 @@ export function registerAllCommands(): void {
registerVsCodeCmd(
'radicle.openOriginalVersionOfPatchedFile',
async (node: FilechangeNode | undefined) => {
if (node?.oldVersionUrl) {
await commands.executeCommand('vscode.open', Uri.file(node.oldVersionUrl))
if (node?.oldVersionUri) {
await commands.executeCommand('vscode.open', node.oldVersionUri)
commands.executeCommand('workbench.action.files.setActiveEditorReadonlyInSession')
} else {
log(
Expand All @@ -137,8 +137,8 @@ export function registerAllCommands(): void {
registerVsCodeCmd(
'radicle.openChangedVersionOfPatchedFile',
async (node: FilechangeNode | undefined) => {
if (node?.newVersionUrl) {
await commands.executeCommand('vscode.open', Uri.file(node.newVersionUrl))
if (node?.newVersionUri) {
await commands.executeCommand('vscode.open', node.newVersionUri)
commands.executeCommand('workbench.action.files.setActiveEditorReadonlyInSession')
} else {
log(
Expand Down
Loading
Loading