Introduce findFilesGlob configuration. Allows to define where to look for the files.#69
Introduce findFilesGlob configuration. Allows to define where to look for the files.#69viktomas wants to merge 4 commits intotchayen:masterfrom
Conversation
src/utils.ts
Outdated
| export const FILE_ID_REGEXP = getFileIdRegexp(); | ||
|
|
||
| export const getFileTypesSetting = () => { | ||
| export const getFileSearchExpression = (): string => { |
There was a problem hiding this comment.
I'm not sure about the naming getFileSearchExpression. It could be changed to getFindFilesGlob to make it more in sync with VS Code API?
There was a problem hiding this comment.
getFindFilesGlob sounds better to me. Although we probably don't want to shadow the API in case this is what happens here (I don't fully get what you mean so might be talking nonsense).
There was a problem hiding this comment.
I agree, findFilesGlob sounds better. I renamed:
getFilesSearchExpressiontogetFindFilesGlobsearchGlobtofindFilesGlob
This way it's consistent throughout the whole change.
I don't fully get what you mean so might be talking nonsense
The second sentence in my comment only meant that VS Code API decided to name the option for finding files getFindFilesGlob. I think that it's good that we use the same naming if we don't have a particular reason to diverge.
|
|
||
| export const getFileTypesSetting = () => { | ||
| export const getFileSearchExpression = (): string => { | ||
| const configFileTypes: string[] = getConfiguration("fileTypes"); |
There was a problem hiding this comment.
We should probably either deprecate this search option or include it to package.json and README.
package.json
Outdated
| "description": "Regular extension used to find file IDs. First match of this regex in file contents, excluding [[links]], will be used as the file ID. This file ID can be used for wiki-style links." | ||
| "description": "Regular expression used to find file IDs. First match of this regex in file contents, excluding [[links]], will be used as the file ID. This file ID can be used for wiki-style links." | ||
| }, | ||
| "markdown-links.searchGlob" : { |
There was a problem hiding this comment.
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 like fileSearchGlob findFilesExpression or any cobination of the search, find, files, expression, glob..
There was a problem hiding this comment.
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. Maybe fileDiscoveryGlob presents it better?
There was a problem hiding this comment.
I went with findFilesGlob for consistency. Let me know if that's ok :)
|
Will this allow sub-directories to be excluded from the search? |
|
@Craskermasker in some limited cases. This feature is more for defining where your notes are than where they aren't. You can see more details in the VS Code API documentation for There is an |
|
@tchayen I addressed your feedback and tested the change locally (it still works). Please let me know if there's anything else I can do 👍 |
Closes #63
This PR introduces a new configuration option,
searchGlob. The configuration option isnullby default and doesn't interfere with the current logic.If set, the option overrides the expression generated from
fileTypesconfiguration. If thefileTypesconfiguration has been set, we'll warn the user:This PR contains 3 commits:
I tried to write tests, but I wasn't able to run them since this extension uses
webpackrather than plaintsc.