Skip to content

Commit 19b34fe

Browse files
gunadhyacalebcartwright
authored andcommitted
Added Updated default version to Rustfmt docs config
1 parent e16d4f3 commit 19b34fe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: docs/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
</div>
8888
<script>
8989
const RusfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags';
90+
const RustfmtLatestUrl = 'https://api.github.com/repos/rust-lang/rustfmt/releases/latest';
9091
const UrlHash = window.location.hash.replace(/^#/, '');
9192
const queryParams = new URLSearchParams(window.location.search);
9293
const searchParam = queryParams.get('search');
@@ -112,6 +113,16 @@
112113
scrolledOnce: false,
113114
},
114115
asyncComputed: {
116+
async updateVersion() {
117+
let latest;
118+
try {
119+
latest = (await axios.get(RustfmtLatestUrl)).data;
120+
} catch(err) {
121+
console.log(err);
122+
return;
123+
}
124+
this.version = latest.name;
125+
},
115126
async outputHtml() {
116127
if (this.version !== this.oldVersion) {
117128
const ConfigurationMdUrl =

0 commit comments

Comments
 (0)