Skip to content

Commit

Permalink
Merge branch 'main' into benibenj/treeStickyScroll
Browse files Browse the repository at this point in the history
  • Loading branch information
benibenj authored Nov 21, 2023
2 parents 252be64 + 9cc10ae commit 13b6a07
Show file tree
Hide file tree
Showing 134 changed files with 1,970 additions and 841 deletions.
6 changes: 3 additions & 3 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@
{
"command": "git.timeline.openCommit",
"title": "%command.timelineOpenCommit%",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
},
{
Expand Down Expand Up @@ -763,13 +763,13 @@
{
"command": "git.viewChanges",
"title": "View Changes",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
},
{
"command": "git.viewStagedChanges",
"title": "View Staged Changes",
"icon": "$(search)",
"icon": "$(tasklist)",
"category": "Git"
}
],
Expand Down
4 changes: 2 additions & 2 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3653,12 +3653,12 @@ export class CommandCenter {

@command('git.viewChanges', { repository: true })
viewChanges(repository: Repository): void {
this._viewChanges('Changes', repository.workingTreeGroup.resourceStates);
this._viewChanges('Git: Changes', repository.workingTreeGroup.resourceStates);
}

@command('git.viewStagedChanges', { repository: true })
viewStagedChanges(repository: Repository): void {
this._viewChanges('Staged Changes', repository.indexGroup.resourceStates);
this._viewChanges('Git: Staged Changes', repository.indexGroup.resourceStates);
}

private _viewChanges(title: string, resources: Resource[]): void {
Expand Down
9 changes: 9 additions & 0 deletions extensions/markdown-language-features/notebook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ export const activate: ActivationFunction<void> = (ctx) => {
line-height: 1.357em;
white-space: pre-wrap;
}
li p {
margin-bottom: 0.7em;
}
ul,
ol {
margin-bottom: 0.7em;
}
`;
const template = document.createElement('template');
template.classList.add('markdown-style');
Expand Down
3 changes: 2 additions & 1 deletion extensions/markdown-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
"type": "string",
"scope": "resource",
"markdownDescription": "%configuration.markdown.editor.pasteUrlAsFormattedLink.enabled%",
"default":"never",
"default": "never",
"enum": [
"always",
"smart",
Expand Down Expand Up @@ -734,6 +734,7 @@
"morphdom": "^2.6.1",
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.2",
"vscode-languageserver-textdocument": "^1.0.11",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { TextDocument } from 'vscode-languageserver-textdocument';
import * as vscode from 'vscode';
import { ITextDocument } from '../types/textDocument';

export class InMemoryDocument implements ITextDocument {

private readonly _doc: TextDocument;

public readonly uri: vscode.Uri;
public readonly version: number;

constructor(
public readonly uri: vscode.Uri,
private readonly _contents: string,
public readonly version = 0,
) { }
uri: vscode.Uri,
contents: string,
version: number = 0,
) {
this.uri = uri;
this.version = version;
this._doc = TextDocument.create(this.uri.toString(), 'markdown', 0, contents);
}

getText(): string {
return this._contents;
getText(range?: vscode.Range): string {
return this._doc.getText(range);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async function insertLink(activeEditor: vscode.TextEditor, selectedFiles: vscode
function createInsertLinkEdit(activeEditor: vscode.TextEditor, selectedFiles: vscode.Uri[], insertAsMedia: boolean, title = '', placeholderValue = 0, pasteAsMarkdownLink = true, isExternalLink = false) {
const snippetEdits = coalesce(activeEditor.selections.map((selection, i): vscode.SnippetTextEdit | undefined => {
const selectionText = activeEditor.document.getText(selection);
const snippet = createUriListSnippet(activeEditor.document, selectedFiles, [], title, placeholderValue, pasteAsMarkdownLink, isExternalLink, {
const snippet = createUriListSnippet(activeEditor.document, selectedFiles.map(uri => ({ uri })), title, placeholderValue, pasteAsMarkdownLink, isExternalLink, {
insertAsMedia,
placeholderText: selectionText,
placeholderStartIndex: (i + 1) * selectedFiles.length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class ResourceDropProvider implements vscode.DocumentDropEditProvider {
private async _getUriListEdit(document: vscode.TextDocument, dataTransfer: vscode.DataTransfer, token: vscode.CancellationToken): Promise<vscode.DocumentDropEdit | undefined> {
const urlList = await dataTransfer.get(Mime.textUriList)?.asString();
if (!urlList || token.isCancellationRequested) {
return undefined;
return;
}

const snippet = await tryGetUriListSnippet(document, urlList, token);
const snippet = tryGetUriListSnippet(document, urlList);
if (!snippet) {
return undefined;
return;
}

const edit = new vscode.DocumentDropEdit(snippet.snippet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class PasteResourceEditProvider implements vscode.DocumentPasteEditProvider {
}

const pasteUrlSetting = getPasteUrlAsFormattedLinkSetting(document);
const pasteEdit = await createEditAddingLinksForUriList(document, ranges, uriList, false, pasteUrlSetting === PasteUrlAsFormattedLink.Smart, token);
const pasteEdit = createEditAddingLinksForUriList(document, ranges, uriList, false, pasteUrlSetting === PasteUrlAsFormattedLink.Smart);
if (!pasteEdit) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as vscode from 'vscode';
import { Mime } from '../../util/mimes';
import { createEditAddingLinksForUriList, getPasteUrlAsFormattedLinkSetting, PasteUrlAsFormattedLink, validateLink } from './shared';
import { createEditAddingLinksForUriList, findValidUriInText, getPasteUrlAsFormattedLinkSetting, PasteUrlAsFormattedLink } from './shared';

class PasteUrlEditProvider implements vscode.DocumentPasteEditProvider {

Expand All @@ -28,11 +28,16 @@ class PasteUrlEditProvider implements vscode.DocumentPasteEditProvider {

const item = dataTransfer.get(Mime.textPlain);
const urlList = await item?.asString();
if (token.isCancellationRequested || !urlList || !validateLink(urlList).isValid) {
if (token.isCancellationRequested || !urlList) {
return;
}

const pasteEdit = await createEditAddingLinksForUriList(document, ranges, validateLink(urlList).cleanedUrlList, true, pasteUrlSetting === PasteUrlAsFormattedLink.Smart, token);
const uriText = findValidUriInText(urlList);
if (!uriText) {
return;
}

const pasteEdit = createEditAddingLinksForUriList(document, ranges, uriText, true, pasteUrlSetting === PasteUrlAsFormattedLink.Smart);
if (!pasteEdit) {
return;
}
Expand Down
Loading

0 comments on commit 13b6a07

Please sign in to comment.