Skip to content

Commit

Permalink
Link to the currently-selected channel's error index
Browse files Browse the repository at this point in the history
Fixes #207
  • Loading branch information
shepmaster committed Apr 26, 2018
1 parent 6b9bbb4 commit 94f90b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ui/frontend/highlighting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Prism from 'prismjs';

export function configureRustErrors(gotoPosition) {
export function configureRustErrors({ gotoPosition, getChannel }) {
Prism.languages.rust_errors = { // eslint-disable-line camelcase
'warning': /warning:.*\n/,
'error': {
Expand All @@ -19,7 +19,7 @@ export function configureRustErrors(gotoPosition) {
const errorMatch = /E\d+/.exec(env.content);
const [errorCode] = errorMatch;
env.tag = 'a';
env.attributes.href = `https://doc.rust-lang.org/error-index.html#${errorCode}`;
env.attributes.href = `https://doc.rust-lang.org/${getChannel()}/error-index.html#${errorCode}`;
}
if (env.type === 'see-issue') {
const errorMatch = /\d+/.exec(env.content);
Expand Down
5 changes: 4 additions & 1 deletion ui/frontend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const enhancers = composeEnhancers(middlewares, persistState(undefined, { serialize, deserialize }));
const store = createStore(playgroundApp, enhancers);

configureRustErrors((line, col) => store.dispatch(gotoPosition(line, col)));
configureRustErrors({
gotoPosition: (line, col) => store.dispatch(gotoPosition(line, col)),
getChannel: () => store.getState().configuration.channel,
});

store.dispatch(performCratesLoad());
store.dispatch(performVersionsLoad());
Expand Down

0 comments on commit 94f90b3

Please sign in to comment.