-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
[autocomplete-css] Suggestions are ordered strangely #541
Comments
So I'm not sure there's an easy solution here. Since previously in Atom, (and the version of So when it came time that we wanted to update Now So I'm not sure what answer would be able to achieve what you are looking, other than us repeating the same thing, and taking the time to painstaking sort every value by popularity. So hopefully someone can find what may be an appropriate solution, but at the very least this is exactly what caused the behavior you are seeing |
@confused-Techie Thank you for your response. I understand that it is likely a complicated process. I tried to find a way using the following repo: https://github.com/atom/autocomplete-css This repo does mention a reference that could be used to get started on my manual sorting journey. Thanks again for all your help. |
So the Atom Editing it is possible, but as by default it's in a compressed file might not be the easiest. But looking at our docs can hopefully lead you in the right place. But really, if you are going to the effort of fixing this, it would be really awesome if you could contribute those efforts back to the community by making the changes then opening a PR. Since if this is concerning you, I'm sure it's concerning others as well. When you look within the |
I think there might be some good rules that we can apply — at least for these examples. In both cases, I think shorter completions should match before longer ones. So Also, even if they were the same length, I'd want I haven't looked into how complicated this would be to implement, but I think we could get there without forcing ourselves to do manual curation of the suggestions. |
@confused-Techie Thanks for the info. Out of curiosity. I am extremely new to the whole github thing. If I find a solution that may help others, would you be open to lending some guidance on submitting the PR? (just to make sure I am following the correct protocols/etc.) If not, that's fine, I'll stumble my way through it. Just thought I'd ask. Thanks! |
OK, just looked at the code. I think that, ideally, some of these optimizations would be baked into |
Most certainly. If you get stuck, the Discord is a welcoming place. |
@savetheclocktower In the meantime, I'll close this issue. Thanks again @savetheclocktower & @confused-Techie! |
Nah, it's worth keeping open. It's a valid complaint and I think we can fix it. Thanks for reporting it in the first place! |
@savetheclocktower @confused-Techie Basically my solution was to use the list google provides to reorder the properties in the completions.json file. The way I solved it was using PHP. (I am not very well versed in JS) Then once its finished the reordering process, it'll save a new json file (completions_new.json) which I reference in the provider.coffee code so that the new completions can be used in the editor. (I chose not to override the existing file during testing.) COMPLETIONS = require('../completions_new.json') <?php
//Get propular CSS properties from google's managed list.
//Pretend like this will never go away...
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://chromestatus.com/data/csspopularity',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
//reverse and convert to json.
$google = array_reverse(json_decode($response, true));
curl_close($curl);
//List of current completion values.
$list = json_decode(file_get_contents('completions.json'), true);
//Gather only the properties.
$prop_list = $list['properties'];
//Output file where we will be saving the new json file (for testing.)
$outputFile = fopen("completions_new.json", "w") or die("Unable to open file!");
//Loop over google properies and reorder the list from current properties.
foreach ($google as $property) {
$name = $property['property_name'];
if(isset($prop_list[$name])){
$temp = array($name => $prop_list[$name]);
unset($prop_list[$name]);
$prop_list = array_merge($temp, $prop_list);
}
}
//get pseudo selectors so they can be appended
$pseudoSelectors = $list['pseudoSelectors'];
//remove properies from array
unset($list['properties']);
//remove pseudoSelectors from array
unset($list['pseudoSelectors']);
//Add both properies (reordered) and pseudoSelectors back.
$list['properties'] = $prop_list;
$list['pseudoSelectors'] = $pseudoSelectors;
//Write the new json file.
$new_file = json_decode(file_get_contents('completions_new.json'), true);
$json = json_encode($list, true);
fwrite($outputFile, $json);
fclose($outputFile);
?> Not sure if anyone would be able to easily translate this to JS, but that would likely be more inline with the project. I guess this could also be used in place of actually manually updating the completions file as well. Since it does much of the hard work of moving the popular properties to the top of the array. |
@hblamo Well I didn't realize they exposed this data as a JSON endpoint. This very well could work in the short term. As I do agree with @savetheclocktower that changing the way I really appreciate you coming up with a solution here, and will take a look at implementing this into JavaScript, and adding it directly to the script that generates the |
Yeah, I think this is a fine way of ordering the suggestions in the JSON, and would be useful even if Google stopped generating this data in the future. |
@confused-Techie is there anything I'll need to do in order to use it? simplescreenrecorder-2023-06-13_17.00.29.mp4Pulsar : 1.105.2023061119 |
@m1ga No nothing special should be required. On my near stock install on my work PC typing (Fair warning, the version of Pulsar on my work PC seems slightly out of date, but I wouldn't imagine this has broken from these changes, unless someone wants to confirm) I'd really ensure that the following package's are enabled:
As well as I'd check all of your settings for EDIT: I stand corrected Pulsar |
Thanks for the feedback. You have the old order, padding should be on top (works fine for me in SCSS). I'm using Fedora linux here. Going to test an older version again and also boot up windows to check it there!
Ah, ok 😄 Thanks! |
Thanks in advance for your bug report!
What happened?
When starting to type something like "wid" in a CSS file, I get recommendations such as "windows" before something like "width".
Also when typing "padd" or "marg" I get suggestions for "padding-top" before "padding".
This used to not be the case when I first installed Pulsar (not sure the version) but recently its regressed.
Any suggestions would be great.
Pulsar version
1.105.0
Which OS does this happen on?
🐧 Arch based (Manjaro, Garuda, etc.)
OS details
N/A
Which CPU architecture are you running this on?
64-bit(x86_64)
What steps are needed to reproduce this?
N/A
Additional Information:
No response
The text was updated successfully, but these errors were encountered: