-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce findFilesGlob configuration. Allows to define where to look for the files. #69
base: master
Are you sure you want to change the base?
Changes from 3 commits
a8f4a7a
a651fc9
860c672
2dc95e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ export const findTitle = (ast: MarkdownNode): string | null => { | |
child.children && | ||
child.children.length > 0 | ||
) { | ||
let title = child.children[0].value! | ||
let title = child.children[0].value!; | ||
|
||
const titleMaxLength = getTitleMaxLength(); | ||
if (titleMaxLength > 0 && title.length > titleMaxLength) { | ||
|
@@ -83,7 +83,7 @@ const settingToValue: { [key: string]: vscode.ViewColumn | undefined } = { | |
|
||
export const getTitleMaxLength = () => { | ||
return getConfiguration("titleMaxLength"); | ||
} | ||
}; | ||
|
||
export const getColumnSetting = (key: string) => { | ||
const column = getConfiguration(key); | ||
|
@@ -102,9 +102,20 @@ export const getFileIdRegexp = () => { | |
|
||
export const FILE_ID_REGEXP = getFileIdRegexp(); | ||
|
||
export const getFileTypesSetting = () => { | ||
export const getFileSearchExpression = (): string => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about the naming There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree,
This way it's consistent throughout the whole change.
The second sentence in my comment only meant that VS Code API decided to name the option for finding files |
||
const configFileTypes: string[] = getConfiguration("fileTypes"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably either deprecate this search option or include it to |
||
const searchGlob: string = getConfiguration("searchGlob"); | ||
if (searchGlob) { | ||
if (configFileTypes) { | ||
vscode.window.showWarningMessage( | ||
"You have both fileTypes and searchGlob settings defined, searchGlob is taking precedence." | ||
); | ||
} | ||
return searchGlob; | ||
} | ||
const DEFAULT_VALUE = ["md"]; | ||
return getConfiguration("fileTypes") || DEFAULT_VALUE; | ||
const fileTypes = configFileTypes || DEFAULT_VALUE; | ||
return `**/*{${fileTypes.map((f) => `.${f}`).join(",")}}`; | ||
}; | ||
|
||
export const getDot = (graph: Graph) => `digraph g { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we release this PR,
searchGlob
is going to be a part of the public interface and very hard to rename in the future. I'm open to any other names likefileSearchGlob
findFilesExpression
or any cobination of thesearch
,find
,files
,expression
,glob
..There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea. Appreciate a lot the fact that you consider it already at this point!
I think
searchGlob
is ok. Maybe it would be more future proof to specify what is the search we are doing here. MaybefileDiscoveryGlob
presents it better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with
findFilesGlob
for consistency. Let me know if that's ok :)