Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Don't load Flow if a .flowconfig cannot be found #95

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Master


* Do not start the extension if a .flowconfig cannot be found. - [@orta][] [#95](https://github.com/flowtype/flow-for-vscode/pull/95)
* Adds the status indicator (spinner) to the statusbar which appears when flow is
type checking, so that users can tell if everything type checked or if flow is
just not finished yet. Indicator can be disabled by setting `flow.showStatus` to
Expand All @@ -20,11 +22,11 @@
### 0.5.0

* Uses the absolute path to the `where` command provided by Windows - JPanneel #69
* Uses the new VS Code autocompletion API for functions - orta #51
* Uses the new VS Code autocompletion API for functions - [@orta][] #51
* When you want to work on the flow-for-vscode project, pressing run will start the
babel build watcher task - orta
babel build watcher task - [@orta][]
* Adds support for *.js.flow files ( such as those generated by graphql-js ) which are
treated as common JavaScript files - orta
treated as common JavaScript files - [@orta][]
* Fixes "File not found" error with diagnostics when `flow status --json` provides
non-absolute file paths - ryanashcraft #77

Expand All @@ -33,7 +35,8 @@
* Adds the ability to use flow from your project's node_modules folder.
This is a security risk ( see https://github.com/facebook/nuclide/issues/570) and so it
is hidden behind a user setting of `useNPMPackagedFlow` which needs to be set to `true`
for it to work. - orta #53
* Show flow errors that start at line 0 - orta #54
for it to work. - [@orta][] #53
* Show flow errors that start at line 0 - [@orta][] #54

[@gozala]:https://github.com/Gozala
[@orta]:https://github.com/orta
38 changes: 23 additions & 15 deletions lib/flowMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {DeclarationSupport} from './flowDeclaration';
import {setupDiagnostics} from './flowDiagnostics';

import {checkNode, checkFlow, isFlowEnabled} from './utils'
import {clearWorkspaceCaches} from './pkg/flow-base/lib/FlowHelpers'
import {clearWorkspaceCaches, findFlowConfigDir} from './pkg/flow-base/lib/FlowHelpers'

import {setupLogging} from "./flowLogging"

Expand All @@ -29,27 +29,35 @@ const languages = [
'javascriptreact'
]

export function activate(context:ExtensionContext): void {
export function activate(context: ExtensionContext): void {
//User can disable flow for some projects that previously used flow, but it's not have actual typing
if (!isFlowEnabled()) {
return
}
global.vscode = vscode

setupLogging()
checkNode()
checkFlow()
findFlowConfigDir(vscode.workspace.rootPath).then(configPath => {
if (!configPath) {
console.log(`Not starting Flow: Could not find a .flowconfig after a backwards search from ${vscode.workspace.rootPath}.`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ends up in the vscode developer tools web inspector, which is better than nothing IMO.

return
}

// Language features
languages.forEach(lang => {
context.subscriptions.push(vscode.languages.registerHoverProvider(lang, new HoverSupport));
context.subscriptions.push(vscode.languages.registerDefinitionProvider(lang, new DeclarationSupport()));
context.subscriptions.push(vscode.languages.registerCompletionItemProvider(lang, new CompletionSupport(), '.'));
global.vscode = vscode

setupLogging()
checkNode()
checkFlow()

// Language features
languages.forEach(lang => {
context.subscriptions.push(vscode.languages.registerHoverProvider(lang, new HoverSupport));
context.subscriptions.push(vscode.languages.registerDefinitionProvider(lang, new DeclarationSupport()));
context.subscriptions.push(vscode.languages.registerCompletionItemProvider(lang, new CompletionSupport(), '.'));
})
// https://github.com/Microsoft/vscode/issues/7031 Workaround for language scoring for language and in-memory. Check in nearest Insiders build
// context.subscriptions.push(vscode.languages.registerCompletionItemProvider({ language: 'javascript' }, new CompletionSupport(), '.'));
// Diagnostics
setupDiagnostics(context);
})
// https://github.com/Microsoft/vscode/issues/7031 Workaround for language scoring for language and in-memory. Check in nearest Insiders build
// context.subscriptions.push(vscode.languages.registerCompletionItemProvider({ language: 'javascript' }, new CompletionSupport(), '.'));
// Diagnostics
setupDiagnostics(context);
}

vscode.workspace.onDidChangeConfiguration(params => {
Expand Down