Remove "go-to-fidl-source" command
It no longer works with FIDL2. It may return one day.
Change-Id: Icfc7b381945265116070c31edf4efd1c63ac635d
diff --git a/vscode-language-fidl/package.json b/vscode-language-fidl/package.json
index 53d5a06..b116c1e 100644
--- a/vscode-language-fidl/package.json
+++ b/vscode-language-fidl/package.json
@@ -3,7 +3,7 @@
"displayName": "FIDL Language Support",
"description": "Support for FIDL files",
"license": "SEE LICENSE IN LICENSE",
- "version": "0.1.0",
+ "version": "0.1.1",
"publisher": "fuchsia-authors",
"engines": {
"vscode": "^1.10.0"
@@ -11,9 +11,6 @@
"categories": [
"Programming Languages"
],
- "activationEvents": [
- "onCommand:extension.goToFidlSource"
- ],
"main": "./out/extension",
"contributes": {
"languages": [
@@ -35,14 +32,8 @@
"scopeName": "source.fidl",
"path": "./syntaxes/fidl.tmLanguage.json"
}
- ],
- "commands": [
- {
- "command": "extension.goToFidlSource",
- "title": "FIDL: Go To Source"
- }
]
- },
+ },
"homepage": "https://fuchsia.googlesource.com/vscode-language-fidl",
"repository": {
"type": "git",
diff --git a/vscode-language-fidl/src/extension.ts b/vscode-language-fidl/src/extension.ts
index c912af9..2d99392 100644
--- a/vscode-language-fidl/src/extension.ts
+++ b/vscode-language-fidl/src/extension.ts
@@ -1,23 +1,8 @@
'use strict';
import * as vscode from 'vscode';
-import * as fs from 'fs';
-import { findFidlSource } from './findFidlSource';
export function activate(context: vscode.ExtensionContext) {
- let disposable = vscode.commands.registerCommand('extension.goToFidlSource', () => {
- if (vscode.window.activeTextEditor) {
- const fileName = vscode.window.activeTextEditor.document.fileName;
- const fidlFileName = findFidlSource(fileName);
- if (fidlFileName && fs.existsSync(fidlFileName)) {
- vscode.workspace.openTextDocument(fidlFileName).then((doc) => vscode.window.showTextDocument(doc));
- } else {
- vscode.window.showErrorMessage(`Couldn't find FIDL source for ${fileName}`);
- }
- }
- });
-
- context.subscriptions.push(disposable);
}
export function deactivate() {
diff --git a/vscode-language-fidl/src/findFidlSource.ts b/vscode-language-fidl/src/findFidlSource.ts
deleted file mode 100644
index 436e407..0000000
--- a/vscode-language-fidl/src/findFidlSource.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-// TODO: establish a non-regex way of finding the source FIDL path.
-
-// These regular expressions match FIDL generated binding source files in the
-// Fuchsia tree. They all capture three groups:
-// 1. The path to the root of the Fuchsia tree
-// 2. The path within the Fuchsia tree of the directory containing the FIDL
-// 3. The name of the FIDL source file, without ".fidl"
-const cxx_dart_re = /(^.+)\/(?:out\/[^/]+\/gen\/)(.+)\/([^\/]+)\.fidl[\._-][^/]*$/;
-const go_re = /(^.+)\/(?:out\/[^/]+\/gen\/go\/src\/)(.+)\/([^/]+)\/\3\.core\.go$/;
-const rust_re = /(^.+)\/(?:out\/[^/]+\/gen\/)(.+)\/([^/]+)\.rs$/;
-
-export function findFidlSource(generatedSourcePath: string): string | void {
- const match = generatedSourcePath.match(cxx_dart_re)
- || generatedSourcePath.match(go_re)
- || generatedSourcePath.match(rust_re);
- if (match) {
- return `${match[1]}/${match[2]}/${match[3]}.fidl`;
- }
-}
diff --git a/vscode-language-fidl/test/goToFidlSource.test.ts b/vscode-language-fidl/test/goToFidlSource.test.ts
deleted file mode 100644
index a7d245a..0000000
--- a/vscode-language-fidl/test/goToFidlSource.test.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-
-// var assert = require('assert');
-
-import 'mocha';
-import * as assert from 'assert';
-
-import { findFidlSource } from '../src/findFidlSource';
-
-describe('findFidlSource', function () {
- it("should return null when the input isn't a generated FIDL file", () => {
- assert.equal(null, findFidlSource("/var/log/syslog"));
- });
-
- it("should return null when the input isn't in the Fuchsia out dir", () => {
- assert.equal(null, findFidlSource("/some/path/file.fidl.dart"));
- });
-
- it("should support Dart bindings", () => {
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl.dart"));
- });
-
- it("should support Go bindings", () => {
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/go/src/layer/public/lib/foo/fidl/interface/interface.core.go"));
- });
-
- it("should support Rust bindings", () => {
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.rs"));
- });
-
- it("should support C++ bindings", () => {
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl.cc"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl-common.cc"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl-common.h"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl.h"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl-internal.h"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl-sync.cc"));
- assert.equal("/home/user/fuchsia/layer/public/lib/foo/fidl/interface.fidl",
- findFidlSource("/home/user/fuchsia/out/debug-x86-64/gen/layer/public/lib/foo/fidl/interface.fidl-sync.h"));
- });
-});