Skip to content

Commit

Permalink
resolving conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
swordensen committed Apr 6, 2024
1 parent d467c52 commit c5b3f7f
Show file tree
Hide file tree
Showing 49 changed files with 462 additions and 405 deletions.
5 changes: 4 additions & 1 deletion cli/src/commands/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,12 @@ pub struct CommandShellArgs {
/// Listen on a socket instead of stdin/stdout.
#[clap(long)]
pub on_socket: bool,
/// Listen on a port instead of stdin/stdout.
/// Listen on a host/port instead of stdin/stdout.
#[clap(long, num_args = 0..=1, default_missing_value = "0")]
pub on_port: Option<u16>,
/// Listen on a host/port instead of stdin/stdout.
#[clap[long]]
pub on_host: Option<String>,
/// Require the given token string to be given in the handshake.
#[clap(long, env = "VSCODE_CLI_REQUIRE_TOKEN")]
pub require_token: Option<String>,
Expand Down
15 changes: 11 additions & 4 deletions cli/src/commands/tunnels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ pub async fn command_shell(ctx: CommandContext, args: CommandShellArgs) -> Resul
code_server_args: (&ctx.args).into(),
};

let mut listener: Box<dyn AsyncRWAccepter> = match (args.on_port, args.on_socket) {
(_, true) => {
let mut listener: Box<dyn AsyncRWAccepter> = match (args.on_port, &args.on_host, args.on_socket)
{
(_, _, true) => {
let socket = get_socket_name();
let listener = listen_socket_rw_stream(&socket)
.await
Expand All @@ -168,8 +169,14 @@ pub async fn command_shell(ctx: CommandContext, args: CommandShellArgs) -> Resul

Box::new(listener)
}
(Some(p), _) => {
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), p);
(Some(_), _, _) | (_, Some(_), _) => {
let addr = SocketAddr::new(
args.on_host
.as_ref()
.map(|h| h.parse().map_err(CodeError::InvalidHostAddress))
.unwrap_or(Ok(IpAddr::V4(Ipv4Addr::LOCALHOST)))?,
args.on_port.unwrap_or_default(),
);
let listener = tokio::net::TcpListener::bind(addr)
.await
.map_err(|e| wrap(e, "error listening on port"))?;
Expand Down
3 changes: 1 addition & 2 deletions extensions/ipynb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
},
"enabledApiProposals": [
"documentPaste",
"diffContentOptions",
"dropMetadata"
"diffContentOptions"
],
"activationEvents": [
"onNotebook:jupyter-notebook",
Expand Down
6 changes: 3 additions & 3 deletions extensions/ipynb/src/notebookImagePaste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getImageMimeType(uri: vscode.Uri): string | undefined {

class DropOrPasteEditProvider implements vscode.DocumentPasteEditProvider, vscode.DocumentDropEditProvider {

public static readonly kind = vscode.DocumentPasteEditKind.Empty.append('markdown', 'image', 'attachment');
public static readonly kind = vscode.DocumentDropOrPasteEditKind.Empty.append('markdown', 'image', 'attachment');

async provideDocumentPasteEdits(
document: vscode.TextDocument,
Expand All @@ -68,7 +68,7 @@ class DropOrPasteEditProvider implements vscode.DocumentPasteEditProvider, vscod
}

const pasteEdit = new vscode.DocumentPasteEdit(insert.insertText, vscode.l10n.t('Insert Image as Attachment'), DropOrPasteEditProvider.kind);
pasteEdit.yieldTo = [vscode.DocumentPasteEditKind.Empty.append('text')];
pasteEdit.yieldTo = [vscode.DocumentDropOrPasteEditKind.Empty.append('text')];
pasteEdit.additionalEdit = insert.additionalEdit;
return [pasteEdit];
}
Expand All @@ -85,7 +85,7 @@ class DropOrPasteEditProvider implements vscode.DocumentPasteEditProvider, vscod
}

const dropEdit = new vscode.DocumentDropEdit(insert.insertText);
dropEdit.yieldTo = [vscode.DocumentPasteEditKind.Empty.append('text')];
dropEdit.yieldTo = [vscode.DocumentDropOrPasteEditKind.Empty.append('text')];
dropEdit.additionalEdit = insert.additionalEdit;
dropEdit.title = vscode.l10n.t('Insert Image as Attachment');
return dropEdit;
Expand Down
4 changes: 1 addition & 3 deletions extensions/ipynb/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.documentPaste.d.ts",
"../../src/vscode-dts/vscode.proposed.dropMetadata.d.ts"

"../../src/vscode-dts/vscode.proposed.documentPaste.d.ts"
]
}
3 changes: 1 addition & 2 deletions extensions/markdown-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"Programming Languages"
],
"enabledApiProposals": [
"documentPaste",
"dropMetadata"
"documentPaste"
],
"activationEvents": [
"onLanguage:markdown",
Expand Down
4 changes: 2 additions & 2 deletions extensions/markdown-language-features/server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-markdown-languageserver",
"description": "Markdown language server",
"version": "0.5.0-alpha.4",
"version": "0.5.0-alpha.5",
"author": "Microsoft Corporation",
"license": "MIT",
"engines": {
Expand All @@ -18,7 +18,7 @@
"vscode-languageserver": "^8.1.0",
"vscode-languageserver-textdocument": "^1.0.8",
"vscode-languageserver-types": "^3.17.3",
"vscode-markdown-languageservice": "^0.5.0-alpha.4",
"vscode-markdown-languageservice": "^0.5.0-alpha.5",
"vscode-uri": "^3.0.7"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions extensions/markdown-language-features/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export async function startServer(connection: Connection, serverConfig: {
documentLinkProvider: { resolveProvider: true },
documentSymbolProvider: true,
foldingRangeProvider: true,
hoverProvider: true,
referencesProvider: true,
renameProvider: { prepareProvider: true, },
selectionRangeProvider: true,
Expand Down Expand Up @@ -246,6 +247,15 @@ export async function startServer(connection: Connection, serverConfig: {
return codeAction;
});

connection.onHover(async (params, token) => {
const document = documents.get(params.textDocument.uri);
if (!document) {
return null;
}

return mdLs!.getHover(document, params.position, token);
});

connection.onRequest(protocol.getReferencesToFileInWorkspace, (async (params: { uri: string }, token: CancellationToken) => {
return mdLs!.getFileReferences(URI.parse(params.uri), token);
}));
Expand Down
8 changes: 4 additions & 4 deletions extensions/markdown-language-features/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ vscode-languageserver@^8.1.0:
dependencies:
vscode-languageserver-protocol "3.17.3"

vscode-markdown-languageservice@^0.5.0-alpha.4:
version "0.5.0-alpha.4"
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.5.0-alpha.4.tgz#900faff6cb0784495117399bc6215691f7800d9b"
integrity sha512-Df6GzywR5cJ3LfBio3Fx45MfJJwDBVg5tcfpzH9XTvExYeHd1pHOUKssJLW4LBSX4bXwiFsNqrOB8va03d8LQQ==
vscode-markdown-languageservice@^0.5.0-alpha.5:
version "0.5.0-alpha.5"
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.5.0-alpha.5.tgz#d4c5a4b7ab8d03a9dbbdf64ce51862686ca05cf8"
integrity sha512-yu2TbIj2alrgh7JAzGQS4YadSBX4MDT7UjgrT4BQvtGfXOPC4G76llP4iZpkDWPBvAXywxnMZ9eZ3N15f81InA==
dependencies:
"@vscode/l10n" "^0.0.10"
node-html-parser "^6.1.5"
Expand Down
3 changes: 3 additions & 0 deletions extensions/markdown-language-features/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export async function startClient(factory: LanguageClientConstructor, parser: IM
return looksLikeMarkdownPath(resource);
},
},
markdown: {
supportHtml: true,
}
};

const client = factory('markdown', vscode.l10n.t("Markdown Language Server"), clientOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum CopyFilesSettings {
*/
class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, vscode.DocumentDropEditProvider {

public static readonly kind = vscode.DocumentPasteEditKind.Empty.append('markdown', 'link');
public static readonly kind = vscode.DocumentDropOrPasteEditKind.Empty.append('markdown', 'link');

public static readonly mimeTypes = [
Mime.textUriList,
Expand All @@ -39,8 +39,8 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v
];

private readonly _yieldTo = [
vscode.DocumentPasteEditKind.Empty.append('text'),
vscode.DocumentPasteEditKind.Empty.append('markdown', 'image', 'attachment'),
vscode.DocumentDropOrPasteEditKind.Empty.append('text'),
vscode.DocumentDropOrPasteEditKind.Empty.append('markdown', 'image', 'attachment'),
];

constructor(
Expand Down Expand Up @@ -133,7 +133,7 @@ class ResourcePasteOrDropProvider implements vscode.DocumentPasteEditProvider, v
}

if (!(await shouldInsertMarkdownLinkByDefault(this._parser, document, settings.insert, ranges, token))) {
edit.yieldTo.push(vscode.DocumentPasteEditKind.Empty.append('uri'));
edit.yieldTo.push(vscode.DocumentDropOrPasteEditKind.Empty.append('uri'));
}

return edit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { UriList } from '../../util/uriList';
*/
class PasteUrlEditProvider implements vscode.DocumentPasteEditProvider {

public static readonly kind = vscode.DocumentPasteEditKind.Empty.append('markdown', 'link');
public static readonly kind = vscode.DocumentDropOrPasteEditKind.Empty.append('markdown', 'link');

public static readonly pasteMimeTypes = [Mime.textPlain];

Expand Down Expand Up @@ -61,8 +61,8 @@ class PasteUrlEditProvider implements vscode.DocumentPasteEditProvider {

if (!(await shouldInsertMarkdownLinkByDefault(this._parser, document, pasteUrlSetting, ranges, token))) {
pasteEdit.yieldTo = [
vscode.DocumentPasteEditKind.Empty.append('text'),
vscode.DocumentPasteEditKind.Empty.append('uri')
vscode.DocumentDropOrPasteEditKind.Empty.append('text'),
vscode.DocumentDropOrPasteEditKind.Empty.append('uri')
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,5 @@ export interface DropOrPasteEdit {
readonly snippet: vscode.SnippetString;
readonly label: string;
readonly additionalEdits: vscode.WorkspaceEdit;
readonly yieldTo: vscode.DocumentPasteEditKind[];
readonly yieldTo: vscode.DocumentDropOrPasteEditKind[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Mime } from '../util/mimes';

class UpdatePastedLinksEditProvider implements vscode.DocumentPasteEditProvider {

public static readonly kind = vscode.DocumentPasteEditKind.Empty.append('text', 'markdown', 'updateLinks');
public static readonly kind = vscode.DocumentDropOrPasteEditKind.Empty.append('text', 'markdown', 'updateLinks');

public static readonly metadataMime = 'vnd.vscode.markdown.updateLinksMetadata';

Expand Down
3 changes: 1 addition & 2 deletions extensions/markdown-language-features/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.documentPaste.d.ts",
"../../src/vscode-dts/vscode.proposed.dropMetadata.d.ts"
"../../src/vscode-dts/vscode.proposed.documentPaste.d.ts"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suite.skip('vscode API - Copy Paste', function () {
dataTransfer.set(textPlain, new vscode.DataTransferItem(reversed));
}
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
const newDocContent = getNextDocumentText(testDisposables, doc);
Expand All @@ -62,7 +62,7 @@ suite.skip('vscode API - Copy Paste', function () {
dataTransfer.set(textPlain, new vscode.DataTransferItem(reversed + '\n'));
}
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
const newDocContent = getNextDocumentText(testDisposables, doc);
Expand All @@ -88,7 +88,7 @@ suite.skip('vscode API - Copy Paste', function () {
dataTransfer.set(textPlain, new vscode.DataTransferItem(`(${ranges.length})${selections.join(' ')}`));
}
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
editor.selections = [new vscode.Selection(0, 0, 0, 0)];
Expand Down Expand Up @@ -118,7 +118,7 @@ suite.skip('vscode API - Copy Paste', function () {
dataTransfer.set(textPlain, new vscode.DataTransferItem('a'));
providerAResolve();
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

// Later registered providers will be called first
testDisposables.push(vscode.languages.registerDocumentPasteEditProvider({ language: 'plaintext' }, new class implements vscode.DocumentPasteEditProvider {
Expand All @@ -132,7 +132,7 @@ suite.skip('vscode API - Copy Paste', function () {

dataTransfer.set(textPlain, new vscode.DataTransferItem('b'));
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
const newDocContent = getNextDocumentText(testDisposables, doc);
Expand All @@ -159,7 +159,7 @@ suite.skip('vscode API - Copy Paste', function () {
dataTransfer.set(textPlain, new vscode.DataTransferItem('xyz'));
providerAResolve();
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

testDisposables.push(vscode.languages.registerDocumentPasteEditProvider({ language: 'plaintext' }, new class implements vscode.DocumentPasteEditProvider {
async prepareDocumentPaste(_document: vscode.TextDocument, _ranges: readonly vscode.Range[], dataTransfer: vscode.DataTransfer, _token: vscode.CancellationToken): Promise<void> {
Expand All @@ -172,7 +172,7 @@ suite.skip('vscode API - Copy Paste', function () {
const str = await entry!.asString();
dataTransfer.set(textPlain, new vscode.DataTransferItem(reverseString(str)));
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
const newDocContent = getNextDocumentText(testDisposables, doc);
Expand All @@ -192,13 +192,13 @@ suite.skip('vscode API - Copy Paste', function () {
async prepareDocumentPaste(_document: vscode.TextDocument, _ranges: readonly vscode.Range[], dataTransfer: vscode.DataTransfer, _token: vscode.CancellationToken): Promise<void> {
dataTransfer.set(textPlain, new vscode.DataTransferItem('xyz'));
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

testDisposables.push(vscode.languages.registerDocumentPasteEditProvider({ language: 'plaintext' }, new class implements vscode.DocumentPasteEditProvider {
async prepareDocumentPaste(_document: vscode.TextDocument, _ranges: readonly vscode.Range[], _dataTransfer: vscode.DataTransfer, _token: vscode.CancellationToken): Promise<void> {
throw new Error('Expected testing error from bad provider');
}
}, { providedPasteEditKinds: [vscode.DocumentPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));
}, { providedPasteEditKinds: [vscode.DocumentDropOrPasteEditKind.Empty.append('test')], copyMimeTypes: [textPlain] }));

await vscode.commands.executeCommand('editor.action.clipboardCopyAction');
const newDocContent = getNextDocumentText(testDisposables, doc);
Expand Down
1 change: 0 additions & 1 deletion src/vs/base/browser/ui/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,6 @@ ${formatRule(Codicon.menuSubmenu)}
.monaco-menu .monaco-action-bar.vertical .keybinding {
font-size: inherit;
padding: 0 2em;
overflow: hidden;
max-height: 100%;
}
Expand Down
7 changes: 4 additions & 3 deletions src/vs/editor/common/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ export type DropYieldTo = { readonly kind: HierarchicalKind } | { readonly mimeT
/**
* @internal
*/
export interface DocumentOnDropEdit {
export interface DocumentDropEdit {
readonly title: string;
readonly kind: HierarchicalKind | undefined;
readonly handledMimeType?: string;
Expand All @@ -2158,11 +2158,12 @@ export interface DocumentOnDropEdit {
/**
* @internal
*/
export interface DocumentOnDropEditProvider {
export interface DocumentDropEditProvider {
readonly id?: string;
readonly dropMimeTypes?: readonly string[];

provideDocumentOnDropEdits(model: model.ITextModel, position: IPosition, dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): ProviderResult<DocumentOnDropEdit[]>;
provideDocumentDropEdits(model: model.ITextModel, position: IPosition, dataTransfer: IReadonlyVSDataTransfer, token: CancellationToken): ProviderResult<DocumentDropEdit[]>;
resolveDocumentDropEdit?(edit: DocumentDropEdit, token: CancellationToken): Promise<DocumentDropEdit>;
}

export interface DocumentContextItem {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/common/services/languageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { LanguageFeatureRegistry, NotebookInfoResolver } from 'vs/editor/common/languageFeatureRegistry';
import { CodeActionProvider, CodeLensProvider, CompletionItemProvider, DeclarationProvider, DefinitionProvider, DocumentColorProvider, DocumentFormattingEditProvider, DocumentHighlightProvider, DocumentOnDropEditProvider, DocumentPasteEditProvider, DocumentRangeFormattingEditProvider, DocumentRangeSemanticTokensProvider, DocumentSemanticTokensProvider, DocumentSymbolProvider, EvaluatableExpressionProvider, FoldingRangeProvider, HoverProvider, ImplementationProvider, InlayHintsProvider, InlineCompletionsProvider, InlineValuesProvider, LinkedEditingRangeProvider, LinkProvider, MappedEditsProvider, MultiDocumentHighlightProvider, NewSymbolNamesProvider, OnTypeFormattingEditProvider, ReferenceProvider, RenameProvider, SelectionRangeProvider, SignatureHelpProvider, TypeDefinitionProvider, InlineEditProvider } from 'vs/editor/common/languages';
import { CodeActionProvider, CodeLensProvider, CompletionItemProvider, DeclarationProvider, DefinitionProvider, DocumentColorProvider, DocumentFormattingEditProvider, DocumentHighlightProvider, DocumentDropEditProvider, DocumentPasteEditProvider, DocumentRangeFormattingEditProvider, DocumentRangeSemanticTokensProvider, DocumentSemanticTokensProvider, DocumentSymbolProvider, EvaluatableExpressionProvider, FoldingRangeProvider, HoverProvider, ImplementationProvider, InlayHintsProvider, InlineCompletionsProvider, InlineValuesProvider, LinkedEditingRangeProvider, LinkProvider, MappedEditsProvider, MultiDocumentHighlightProvider, NewSymbolNamesProvider, OnTypeFormattingEditProvider, ReferenceProvider, RenameProvider, SelectionRangeProvider, SignatureHelpProvider, TypeDefinitionProvider, InlineEditProvider } from 'vs/editor/common/languages';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';

export const ILanguageFeaturesService = createDecorator<ILanguageFeaturesService>('ILanguageFeaturesService');
Expand Down Expand Up @@ -75,7 +75,7 @@ export interface ILanguageFeaturesService {

readonly evaluatableExpressionProvider: LanguageFeatureRegistry<EvaluatableExpressionProvider>;

readonly documentOnDropEditProvider: LanguageFeatureRegistry<DocumentOnDropEditProvider>;
readonly documentDropEditProvider: LanguageFeatureRegistry<DocumentDropEditProvider>;

readonly mappedEditsProvider: LanguageFeatureRegistry<MappedEditsProvider>;

Expand Down
Loading

0 comments on commit c5b3f7f

Please sign in to comment.