Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Only override paths when file actually exists within the cwd/remoteRoot #350

Merged
merged 2 commits into from
Jun 13, 2018
Merged
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
56 changes: 32 additions & 24 deletions src/debugger/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,36 +293,44 @@ class RubyDebugSession extends DebugSession {
return localPath.replace(/\\/g, '/');
}

protected convertClientPathToDebugger(localPath: string): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found that most of this code was formatted with tabs while the rest of the file was using spaces so I fixed that up too!

spaces

if (this.debugMode == Mode.launch) {
return localPath;
}
protected convertClientPathToDebugger(localPath: string): string {
if (this.debugMode == Mode.launch) {
return localPath;
}

var relativePath = path.join(
this.requestArguments.remoteWorkspaceRoot, localPath.substring(this.requestArguments.cwd.length)
);
if (!localPath.startsWith(this.requestArguments.cwd)) {
return localPath;
}

var sepIndex = this.requestArguments.remoteWorkspaceRoot.lastIndexOf('/');
var relativePath = path.join(
this.requestArguments.remoteWorkspaceRoot, localPath.substring(this.requestArguments.cwd.length)
);

if (sepIndex !== -1) {
// *inx or darwin
relativePath = relativePath.replace(/\\/g, '/');
}
var sepIndex = this.requestArguments.remoteWorkspaceRoot.lastIndexOf('/');

return relativePath;
}
if (sepIndex !== -1) {
// *inx or darwin
relativePath = relativePath.replace(/\\/g, '/');
}

protected convertDebuggerPathToClient(serverPath: string):string{
if (this.debugMode == Mode.launch) {
return serverPath;
}
return relativePath;
}

// Path.join will convert the path using local OS preferred separator
var relativePath = path.join(
this.requestArguments.cwd, serverPath.substring(this.requestArguments.remoteWorkspaceRoot.length)
);
return relativePath;
}
protected convertDebuggerPathToClient(serverPath: string):string{
if (this.debugMode == Mode.launch) {
return serverPath;
}

if (!serverPath.startsWith(this.requestArguments.remoteWorkspaceRoot)) {
return serverPath;
}

// Path.join will convert the path using local OS preferred separator
var relativePath = path.join(
this.requestArguments.cwd, serverPath.substring(this.requestArguments.remoteWorkspaceRoot.length)
);
return relativePath;
}

protected switchFrame(frameId) {
if (frameId === this._frameId) return;
Expand Down
2 changes: 1 addition & 1 deletion src/locate/locate.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function filter(symbols, query, matcher) {
.uniq()
.value();
}
module.exports = class Locate {
export class Locate {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to get the build green, looks like it did the trick!

constructor(root, settings) {
this.settings = settings;
this.root = root;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/intellisense.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { ExtensionContext, SymbolKind, SymbolInformation } from 'vscode';
import * as Locate from '../locate/locate';
import { Locate } from '../locate/locate';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to get the build green, looks like it did the trick!


export function registerIntellisenseProvider(ctx: ExtensionContext) {
// for locate: if it's a project, use the root, othewise, don't bother
Expand Down