mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 12:00:24 -04:00
Merge from vscode 777931080477e28b7c27e8f7d4b0d69897945946 (#9220)
This commit is contained in:
@@ -9,7 +9,7 @@ import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand, IEditOperationBuilder, ICursorStateComputerData } from 'vs/editor/common/editorCommon';
|
||||
import { IIdentifiedSingleEditOperation, ITextModel } from 'vs/editor/common/model';
|
||||
import { ITextModel, IIdentifiedSingleEditOperation } from 'vs/editor/common/model';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
|
||||
export class BlockCommentCommand implements ICommand {
|
||||
|
||||
@@ -205,7 +205,7 @@ export class LineCommentCommand implements ICommand {
|
||||
|
||||
for (let i = 0, len = ops.length; i < len; i++) {
|
||||
builder.addEditOperation(ops[i].range, ops[i].text);
|
||||
if (ops[i].range.isEmpty() && ops[i].range.getStartPosition().equals(cursorPosition)) {
|
||||
if (Range.isEmpty(ops[i].range) && Range.getStartPosition(ops[i].range).equals(cursorPosition)) {
|
||||
const lineContent = model.getLineContent(cursorPosition.lineNumber);
|
||||
if (lineContent.length + 1 === cursorPosition.column) {
|
||||
this._deltaColumn = (ops[i].text || '').length;
|
||||
|
||||
@@ -25,6 +25,10 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { editorActiveLinkForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
|
||||
function getHoverMessage(link: Link, useMetaKey: boolean): MarkdownString {
|
||||
const executeCmd = link.url && /^command:/i.test(link.url.toString());
|
||||
@@ -291,7 +295,29 @@ class LinkDetector implements IEditorContribution {
|
||||
const { link } = occurrence;
|
||||
|
||||
link.resolve(CancellationToken.None).then(uri => {
|
||||
// open the uri
|
||||
|
||||
// Support for relative file URIs of the shape file://./relativeFile.txt or file:///./relativeFile.txt
|
||||
if (typeof uri === 'string' && this.editor.hasModel()) {
|
||||
const modelUri = this.editor.getModel().uri;
|
||||
if (modelUri.scheme === Schemas.file && strings.startsWith(uri, 'file:')) {
|
||||
const parsedUri = URI.parse(uri);
|
||||
if (parsedUri.scheme === Schemas.file) {
|
||||
const fsPath = resources.originalFSPath(parsedUri);
|
||||
|
||||
let relativePath: string | null = null;
|
||||
if (strings.startsWith(fsPath, '/./')) {
|
||||
relativePath = `.${fsPath.substr(1)}`;
|
||||
} else if (strings.startsWith(fsPath, '//./')) {
|
||||
relativePath = `.${fsPath.substr(2)}`;
|
||||
}
|
||||
|
||||
if (relativePath) {
|
||||
uri = resources.joinPath(modelUri, relativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.openerService.open(uri, { openToSide, fromUserGesture });
|
||||
|
||||
}, err => {
|
||||
|
||||
Reference in New Issue
Block a user