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

Commit

Permalink
Don't load Flow if a .flowconfig cannot be found on a recursive searc…
Browse files Browse the repository at this point in the history
…h from workspace root - #81
  • Loading branch information
orta committed Mar 22, 2017
1 parent edb8c54 commit 28f184a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
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}.`)
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

0 comments on commit 28f184a

Please sign in to comment.