Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit da3697e

Browse files
committed
Revert Cargo.toml changes
1 parent c6996c5 commit da3697e

File tree

4 files changed

+48
-35
lines changed

4 files changed

+48
-35
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Unreleased
22

3+
### 0.5.3 - 2018-12-08
4+
5+
* Revert Cargo.toml changes
6+
37
### 0.5.2 - 2018-12-07
48

59
* Prefer workspace Cargo.toml to local ones

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "rust",
33
"displayName": "Rust (rls)",
44
"description": "Rust language support - code completion, Intellisense, refactoring, reformatting, errors, snippets. A client for the Rust Language Server, built by the RLS team.",
5-
"version": "0.5.2",
5+
"version": "0.5.3",
66
"publisher": "rust-lang",
77
"icon": "rust-icon.png",
88
"galleryBanner": {

src/extension.ts

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { activateTaskProvider, runCommand } from './tasks';
1717

1818
import * as child_process from 'child_process';
1919
import * as fs from 'fs';
20-
import path = require('path');
20+
//import path = require('path');
2121

2222
import {
2323
commands, ExtensionContext, IndentAction, languages, TextEditor,
@@ -58,7 +58,7 @@ function didOpenTextDocument(document: TextDocument, context: ExtensionContext):
5858
return;
5959
}
6060
folder = getOuterMostWorkspaceFolder(folder);
61-
folder = getCargoTomlWorkspace(folder, document.uri.fsPath);
61+
// folder = getCargoTomlWorkspace(folder, document.uri.fsPath);
6262
if (!folder) {
6363
stopSpinner(`RLS: Cargo.toml missing`);
6464
return;
@@ -92,37 +92,37 @@ function sortedWorkspaceFolders(): string[] {
9292
return _sortedWorkspaceFolders || [];
9393
}
9494

95-
function getCargoTomlWorkspace(cur_workspace: WorkspaceFolder, file_path: string): WorkspaceFolder {
96-
if (!cur_workspace) {
97-
return cur_workspace;
98-
}
99-
100-
const workspace_root = path.parse(cur_workspace.uri.fsPath).dir;
101-
const root_manifest = path.join(workspace_root, 'Cargo.toml');
102-
if (fs.existsSync(root_manifest)) {
103-
return cur_workspace;
104-
}
105-
106-
let current = file_path;
107-
108-
while (true) {
109-
const old = current;
110-
current = path.dirname(current);
111-
if (old == current) {
112-
break;
113-
}
114-
if (workspace_root == path.parse(current).dir) {
115-
break;
116-
}
117-
118-
const cargo_path = path.join(current, 'Cargo.toml');
119-
if (fs.existsSync(cargo_path)) {
120-
return { ...cur_workspace, uri: Uri.parse(current) };
121-
}
122-
}
123-
124-
return cur_workspace;
125-
}
95+
// function getCargoTomlWorkspace(cur_workspace: WorkspaceFolder, file_path: string): WorkspaceFolder {
96+
// if (!cur_workspace) {
97+
// return cur_workspace;
98+
// }
99+
100+
// const workspace_root = path.parse(cur_workspace.uri.fsPath).dir;
101+
// const root_manifest = path.join(workspace_root, 'Cargo.toml');
102+
// if (fs.existsSync(root_manifest)) {
103+
// return cur_workspace;
104+
// }
105+
106+
// let current = file_path;
107+
108+
// while (true) {
109+
// const old = current;
110+
// current = path.dirname(current);
111+
// if (old == current) {
112+
// break;
113+
// }
114+
// if (workspace_root == path.parse(current).dir) {
115+
// break;
116+
// }
117+
118+
// const cargo_path = path.join(current, 'Cargo.toml');
119+
// if (fs.existsSync(cargo_path)) {
120+
// return { ...cur_workspace, uri: Uri.parse(current) };
121+
// }
122+
// }
123+
124+
// return cur_workspace;
125+
// }
126126

127127
function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder {
128128
const sorted = sortedWorkspaceFolders();
@@ -188,6 +188,7 @@ class ClientWorkspace {
188188
}
189189

190190
async start(context: ExtensionContext) {
191+
warnOnMissingCargoToml();
191192

192193
startSpinner('RLS', 'Starting');
193194

@@ -476,7 +477,15 @@ class ClientWorkspace {
476477
}
477478
}
478479

480+
async function warnOnMissingCargoToml() {
481+
const files = await workspace.findFiles('Cargo.toml');
479482

483+
if (files.length < 1) {
484+
window.showWarningMessage(
485+
'A Cargo.toml file must be at the root of the workspace in order to support all features'
486+
);
487+
}
488+
}
480489

481490
function configureLanguage(context: ExtensionContext) {
482491
const disposable = languages.setLanguageConfiguration('rust', {

0 commit comments

Comments
 (0)