Skip to content
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

Reworks the regexp options to use file globbing instead #61

Merged
merged 2 commits into from
Jul 4, 2019

Conversation

arch-stack
Copy link

Regexp wasn't working for everyone, the exclude option was completely non functional
This commit converts to using the standard glob format for file names
It also tidies up the handling of supported languages in the language server
This will make the old setting searchFileExtensions not work anymore and if anyone had regexps in the exclude they prob will not work going forwards until they are converted

Regexp wasn't working for everyone, the exclude option was completely non functional
This commit converts to using the standard glob format for file names
It also tidies up the handling of supported languages in the language server
This will make the old setting searchFileExtensions not work anymore and if anyone had regexps in the exclude they prob will not work going forwards until they are converted
@arch-stack
Copy link
Author

Can someone verify I haven't broken any functionality that I might not be aware of?

fileSearchExtensions
.map(l => l.slice(1))
.concat(activeLanguages)
activeLanguages
Copy link
Owner

Choose a reason for hiding this comment

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

we also need to include the languages for files that we need to look through (i.e. style files like css, sass, less, etc.) so it can't just be activeLanguages. since we only support css, sass and less at the moment, perhaps we can just hard code it:

activeLanguages.concat(['css', 'sass', 'less']).map(...)

Copy link
Author

Choose a reason for hiding this comment

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

Would it make sense if maybe we just included them in the activeLanguages setting default values list?
Then it's completely in the control of the user if they want those active

Copy link
Owner

Choose a reason for hiding this comment

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

Then we unnecessarily trigger peek lookups from within CSS files, when they should only happen in HTML, JSX, PHP, etc.

You could create a new configuration setting, but it kind of doesn't matter because even if someone add ".something", unless CSS_Peek knows how to parse ".something" style files, we can't do anything with it.

I think hardcoding css, sass and less should be fine 😄

Copy link
Author

Choose a reason for hiding this comment

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

Maybe I'm misunderstanding, if I am interpreting it right I have it set to only pull data from the include/exclude stuff and active languages controls which files has the peek stuff enabled

Copy link
Author

Choose a reason for hiding this comment

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

Hey, not sure if you saw this ^ @pranaygp

Copy link
Author

Choose a reason for hiding this comment

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

I can give it a go

Copy link
Author

Choose a reason for hiding this comment

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

@pranaygp check out the newest commit

Copy link
Author

Choose a reason for hiding this comment

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

@pranaygp did you get a chance to check this out

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the ping @arch-stack

Copy link
Owner

Choose a reason for hiding this comment

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

I've had a super busy couple weeks. I'll merge it in this weekend and test it all out before cutting a new version. Thanks a lot for the help @arch-stack!

If you'd like to help maintain css-peek, shoot me an email (pranay.gp@gmail.com)

@@ -10,6 +10,10 @@ let languageServices: { [id: string]: LanguageService } = {
less: getLESSLanguageService()
};

export function isLanguageServiceSupported(serviceId: string) {
Copy link
Owner

Choose a reason for hiding this comment

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

much cleaner 😍

Cleans up some setting terminology to make it easier to understand
Adds a hard coded list of style languages that the client supports
@@ -108,48 +106,39 @@ export function activate(context: ExtensionContext) {
folder = getOuterMostWorkspaceFolder(folder);

if (!clients.has(folder.uri.toString())) {
Promise.all(fileSearchExtensions.map(type => Workspace.findFiles(`**/*${type}`, '')))
Workspace.findFiles(`{${(peekToInclude || []).join(',')}}`, `{${(peekToExclude || []).join(',')}}`,)
Copy link
Owner

Choose a reason for hiding this comment

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

one of these is a list of languages, the other is a list of filetypes, so I don't think this would work 🤔

Copy link
Author

Choose a reason for hiding this comment

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

I have it converting to globs a bit above but I could make a language to extensions map if needed

@pranaygp
Copy link
Owner

pranaygp commented Jul 4, 2019

Sorry for taking this long @arch-stack
Works perfectly. Merging

@pranaygp pranaygp merged commit 8f4ba08 into pranaygp:master Jul 4, 2019
@pranaygp
Copy link
Owner

pranaygp commented Jul 4, 2019

Live in 3.0.2

@arch-stack
Copy link
Author

Sorry for taking this long @arch-stack
Works perfectly. Merging

No prob

@jonlepage
Copy link

not work for me !
i cant have reference when ctrl+click , or on mouseover !
Any help ?
Do i have special setting to do ?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants