-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Be able to specify files to spell check within the config. (#948)
Related to #571 ## Specify `files` Make it possible to specify which files to check in the configuration file. A new configuration field `files` has be added: ```js { // tell cspell to check all JavaScript and Markdown files. files: ["**/*.js", "**/*.md"] } ``` ## Commits * feat: Be able to specify files to spell check within the config. * dev: Use files from config in cli application * dev: add methods to support glob normalization to a common root. * refactor: move the methods to a more logical place. * dev: Correct the order to load configuration files to support VS Code Ext * dev: Normalize globs passed in on the command line. - Added lots of test to ensure behavior. - Added support for `files` to be defined in the configuration. - Fixed some issues related to the root. * dev: build lists of include and exclude globs. * dev: File normalization is now done in cspell-glob. * dev: Use a generator to flatten the results and make them unique. * dev: Normalize relative paths * dev: Use a single glob. * dev: make single glob optional * Use 0.2 for the main cspell.json file * Update launch.json
- Loading branch information
Showing
22 changed files
with
926 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "0.1", | ||
"version": "0.2", | ||
"dictionaryDefinitions": [ | ||
{ | ||
"name": "workspace", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// cspell:ignore fname | ||
|
||
export interface PathInterface { | ||
normalize(p: string): string; | ||
join(...paths: string[]): string; | ||
resolve(...paths: string[]): string; | ||
relative(from: string, to: string): string; | ||
isAbsolute(p: string): boolean; | ||
sep: string; | ||
} | ||
|
||
export type GlobMatch = GlobMatchRule | GlobMatchNoRule; | ||
|
||
export interface GlobMatchRule { | ||
matched: boolean; | ||
glob: string; | ||
root: string; | ||
index: number; | ||
isNeg: boolean; | ||
} | ||
|
||
export interface GlobMatchNoRule { | ||
matched: false; | ||
} | ||
|
||
export type GlobPattern = SimpleGlobPattern | GlobPatternWithRoot | GlobPatternWithOptionalRoot; | ||
|
||
export type SimpleGlobPattern = string; | ||
|
||
export interface GlobPatternWithOptionalRoot { | ||
/** | ||
* a glob pattern | ||
*/ | ||
glob: string; | ||
/** | ||
* The root from which the glob pattern is relative. | ||
* @default: options.root | ||
*/ | ||
root?: string; | ||
/** | ||
* Optional value useful for tracing which file a glob pattern was defined in. | ||
*/ | ||
source?: string; | ||
} | ||
|
||
export interface GlobPatternWithRoot extends GlobPatternWithOptionalRoot { | ||
root: string; | ||
} | ||
|
||
export interface GlobPatternNormalized extends GlobPatternWithRoot { | ||
/** the original glob pattern before it was normalized */ | ||
rawGlob: string; | ||
/** the original root */ | ||
rawRoot: string | undefined; | ||
} |
Oops, something went wrong.